php - 自定义 Wordpress 登录对齐以居中 CSS

标签 php jquery html css wordpress

我有一个将内容居中对齐的简单 CSS 问题,基本上我在左侧有一个 Logo ,在右侧有登录输入。这是我的 function.php 代码

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');

这是我的 css 代码,在这段代码中,我使用伪代码生成带有 Logo 的 div 和带有内容的 div。这些是#login 之前和之后。如您所见,我未能将它们放在一起居中。这是我唯一的问题,默认情况下,#login div 设置为中心,但我添加了一个 div,所以有点乱。

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
}

我还会附上一张我想到的图片。
image

最佳答案

尝试将输入字段和 Logo 设置为显示 block ,然后应用您需要的任何 CSS 将它们居中。

关于php - 自定义 Wordpress 登录对齐以居中 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25281418/

相关文章:

PHP 重新加载聊天框?

php - prestashop 主题的更改未反射(reflect)

Javascript 减去数字不准确 - 为什么

javascript - 如何在setInterval函数中播放声音?

php用户自动登录

php - (Laravel)只检索有关系的用户

jQuery 扩展适用于 jQuery 1.4.4,但不适用于 1.7.2

javascript - 我应该如何在我的页面中突出显示鼠标悬停的任何链接?

html - 在 CSS 中创建背景图案

javascript - JQuery 无法在 .show() 之后显示隐藏元素(复选框)