简体   繁体   中英

Customize Wordpress Login aligning to center CSS

I have a simple CSS problem of aligning the content to center, Basically I have a logo on the left side and the login inputs to the right side. Here is my function.php codes

function custom_login_css() 
{
    echo '<link rel="stylesheet" type="text/css" href="'.get_stylesheet_directory_uri().'/login/login-styles.css" >';
}
add_action('login_head', 'custom_login_css');

And this is my css codes, in this codes, I used pseudocodes that generate a div with the logo and div with the content. Those are the #login before and after. As you can see I failed to put them together to center. That's my only problem, By default the #login div is set to center, but I added a div so it kinda messed up.

body.login {
    background: #525763;
    background-repeat: no-repeat;
    background-size: cover;
    padding: auto !important;
    margin: 0px auto 0px auto !important;
    overflow: hidden;
}
#login {
    border: 1px solid #000 !important;
    box-shadow: none;
    background-image: url('../login/loginbg.png');
    background-size: 350px 500px;
    background-repeat: no-repeat;
    background-position: center;
    padding-left: 10px !important;
    padding-right: 10px !important;
    margin: 0px auto 0px auto !important;
    height: 100%;
    overflow: hidden;
}
.login h1 a {
    background-image: none;
    /*background-size: 212px 219px;
    width: 212px;
    height: 219px;*/
}
.login form {
    margin-left: auto;
    margin-right: auto;
    background: transparent;
    border: 0;
    box-shadow: none;
}
form#loginform {
    top: 10;
    text-align: center !important;
}
#user_login, #user_pass {
    background: #606674;
}
input#wp-submit {
    margin-top: 20px;
    width: 300px !important;
    background: yellow;
    color: #606674;
    border: 0px;
}
#login:before {
    content: " ";
    display: block;
    background-image: url('../login/logo1.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    height: 200px;
    width: 207px;
    position: absolute;
    left: 250px;
    top: 100px
}
#login:after {
    content: "Here at The Design Cereal, we aspire to share real and valuable knowledge to any individual-both new and experienced-who's looking to grow creatively in tech world especially in the advent of creative tools such as Adobe Photoshop and Illustrator. Our easy-to-understand method of writing articles hopes to simplify daunting technical requirements a designer needs to propel himself forward in his creative venture.";
    display: block;
    color: #fff;
    width: 300px;
    position: absolute;
    left: 200px;
    top: 340px
}

I will also include an image that is what I have in mind.
图片

尝试将输入字段和徽标设置为显示块,然后应用所需的任何CSS将它们居中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM