0

我有一个登录页面,在 chrome、chrome(windows)、safari 和 firefox 中似乎可以正常工作,但是当我在 IE 中对其进行测试时。登录框和“忘记用户名或密码”链接之间似乎有很大的中断。我不知道为什么会这样,有人可以帮我解决这个问题吗?

HTML:

<body id="loginpage">
<table cellpadding="0" cellspacing="0" id="maintable">
    <tbody>
        <tr>
            <td id="container">
                <div id="login_header">
                    <a href="#" id="homelink"></a>
                    <h1><b>TEST Vario Press CMS Demo</b></h1>
                    <div id="logo"></div>
                </div>
                <div id="content">
                    <!-- Begin Content -->
                    <div id="dialog">
                        <h2>Client Login</h2>
                        <div class="content">
                            <form action="#" name="login" id="login" method="post" accept-charset="utf-8" autocomplete="off" _lpchecked="1">
                                <div id="login_form">
                                    <div class="error"></div>
                                    Please enter your username and password
                                    <ul>
                                        <li id="username_field"><label>Username:</label><input type="text" name="username" value="" id="username" onkeypress="return checkenter(event)"></li>
                                        <li id="password_field"><label>Password:</label><input type="password" name="password" value="" onkeypress="return checkenter(event)"></li>
                                    </ul>
                                </div>
                                <div class="ok_button" title="Login" onclick="login.submit()">
                                    <a href="#">GO</a>
                                </div>
                                <div class="button" id="submit_button">
                                    <input type="submit" name="submit_button" value="Login">
                                </div>
                            </form>
                            <div id="login_links">
                                <div class="forgot">
                                    <a href="#">Forgot username or password?</a>
                                </div>
                                <div class="register">
                                    <a href="#">Register</a>
                                </div>
                            </div>
                            <div class="clear"></div>
                        </div>
                    </div>
                </div>
            </td>
        </tr>
    </tbody>
</table>

CSS:

#login_header h1, #login_header #logo, #header h1 b {
display:none;
}

#dialog {
width:520px;
margin:0 auto;
text-align:center;
color:#FFF;

}

#login_form {
background-color:#808080;
padding:18px;
padding-bottom:42px;
text-align:center;

}

#dialog, #dialog .error {
color:#FFF;
}

#dialog h2 {
background-color: #808080;
background-image: url("../imgs/table_bg.gif");
color:#fff;
padding:9px;
font-size:20px;
text-align:left;
margin:0px;
}

#dialog .content {
padding:0;
list-style: none;
}

#dialog .ok_button {
display:none;
}

#dialog #submit_button input {
padding:7px 5px;
text-align: center;
}

#dialog .clear {
display:none;
}

.highlight_field {
background-color:#f57921;
}

#forgot h3 {
text-align:center;
}

#my_details {
width:auto;
}

#loginpage #my_details {
width:400px;
}

#forgot h3 {
font-size: 12px;
}

#login ul {
margin-left:8px;
list-style: none;

}

#login ul input{
width: 350px;
height: 25px;
    padding-left: 10px;
background-color: #FFF;
border: none;
border-width: 0px;
position: relative;
left: -20px;
    -moz-border-radius: 5px; 
    -webkit-border-radius: 5px;    
    border-radius: 5px;
    behavior : url(../js/PIE.htc);

    /*
-moz-border-radius-topright: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-bottomright: 5px;
-moz-border-radius-bottomleft: 5px;
-webkit-border-top-right-radius: 5px;
-webkit-border-top-left-radius: 5px;
-webkit-border-bottom-right-radius: 5px;
-webkit-border-bottom-left-radius: 5px;*/
}

#login #submit_button {
display:block;
position:relative;
top:-48px;
right:10px;
}

#login_links {
margin-top:0;
text-align:left;
}

#login_links .forgot {
float:none;
display:block;
}

#login_links .register, #login_links .whyregister {
display: none;
}

#login_links .forgot a {
display:block;
width:484px;
color:#FFF;
background-color:#808080;
padding:18px;
font-weight:normal;
text-decoration: none;

}


#login_links .forgot a:hover {
text-decoration: underline;

}

#login label {
width:6em;
display: block;
text-align: left;
/*float: left;*/
line-height: 25px;
margin-left: 22px;

}


#ie6 #login_form {
margin-bottom:-47px;
}

#ie6 #submit_button {
position:relative;
top:-4px;
}

#page_mydetails .recordset {
width:48%;
}

.recordset h4 {
font-size:11px;
background-image:url(../imgs/table_bg.gif);
background-color:#535c66;
color:#fff;
border-bottom:1px solid #FFFFFF;
padding:9px;
}


#loginpage #content {
padding-top:18px;

}

演示:http: //jsfiddle.net/MpEX2/

4

1 回答 1

0

我修复了它,使它在 Chrome 中看起来不错。看到这个小提琴

我移动了 login_form div 中的所有内容并删除了任何位置:relative; 来自 CSS 的东西。我不知道为什么任何东西都在使用 position: relative; 因为它只是搞砸了布局。

尽量不要超过我们的位置:相对和其他定位值,除了默认的静态。另一个古老的建议是不要使用表格进行布局

HTML:

    <table cellpadding="0" cellspacing="0" id="maintable">
    <tbody>
        <tr>
            <td id="container">

                <div id="login_header">
                    <a href="#" id="homelink"></a>
                    <h1><b>TEST Vario Press CMS Demo</b></h1>
                    <div id="logo"></div>
                </div>

                <div id="content">
                    <!-- Begin Content -->

                    <div id="dialog">
                        <h2>Client Login</h2>

                        <div class="content">
                            <form action="#" name="login" id="login" method="post" accept-charset="utf-8" autocomplete="off" _lpchecked="1">
                                <div id="login_form">

                                    <div class="error"></div>

                                    Please enter your username and password
                                    <ul>
                                        <li id="username_field">
                                            <label>Username:</label>
                                            <input type="text" name="username" value="" id="username" onkeypress="return checkenter(event)">
                                        </li>
                                        <li id="password_field">
                                            <label>Password:</label>
                                            <input type="password" name="password" value="" onkeypress="return checkenter(event)">
                                        </li>
                                    </ul>
                                    <div class="ok_button" title="Login" onclick="login.submit()">
                                        <a href="#">GO</a>
                                    </div>

                                    <div class="button" id="submit_button">
                                        <input type="submit" name="submit_button" value="Login">
                                    </div>
                                </div>


                            </form>
                            <div id="login_links">
                                <div class="forgot">
                                    <a href="#">Forgot username or password?</a>
                                </div>
                                <div class="register">
                                    <a href="#">Register</a>
                                </div>
                            </div>
                            <div class="clear"></div>
                        </div>
                    </div>
                </div>
                <div class="clear"></div>
            </td>
        </tr>
    </tbody>
</table>

CSS:

#login_header h1, #login_header #logo, #header h1 b {
    display:none;
}

#dialog {
    width:520px;
    margin:0 auto;
    text-align:center;
    color:#FFF;

}

#login_form {
    background-color:#808080;
    padding:18px;
    padding-bottom:42px;
    text-align:center;

}

#dialog, #dialog .error {
    color:#FFF;
}

#dialog h2 {
    background-color: #808080;
    background-image: url("../imgs/table_bg.gif");
    color:#fff;
    padding:9px;
    font-size:20px;
    text-align:left;
    margin:0px;
}

#dialog .content {
    padding:0;
    list-style: none;
}

#dialog .ok_button {
    display:none;
}

#dialog #submit_button input {
    padding:7px 5px;
    text-align: center;
}

#dialog .clear {
    display:none;
}

.search_button {
    background-image:url(../imgs/nav_ok.gif);
    background-repeat:no-repeat;
    background-position:left -2px;
    width:26px;
    height:30px;
    margin-top:2px;
    margin-right:12px;
    float:right;
    cursor:pointer;
}

.highlight_field {
    background-color:#f57921;
}

#forgot h3 {
    text-align:center;
}



#my_details {
    width:auto;
}

#loginpage #my_details {
    width:400px;
}

#forgot h3 {
    font-size: 12px;
}

#login ul {
    margin-left:8px;
    list-style: none;

}

#login ul input{
    width: 350px;
    height: 25px;
    padding-left: 10px;
    background-color: #FFF;
    border: none;
    border-width: 0px;
    position: relative;
    left: -20px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
    behavior : url(../js/PIE.htc);

    /*
-moz-border-radius-topright: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-bottomright: 5px;
-moz-border-radius-bottomleft: 5px;
-webkit-border-top-right-radius: 5px;
-webkit-border-top-left-radius: 5px;
-webkit-border-bottom-right-radius: 5px;
-webkit-border-bottom-left-radius: 5px;*/
}

#login_links {
    margin-top:0;
    text-align:left;
}

#login_links .forgot {
    float:none;
    display:block;
}

#login_links .register, #login_links .whyregister {
    display: none;
}

#login_links .forgot a {
    display:block;
    width:484px;
    color:#FFF;
    background-color:#808080;
    padding:18px;
    font-weight:normal;
    text-decoration: none;

}


#login_links .forgot a:hover {
    text-decoration: underline;

}

#login label {
    width:6em;
    display: block;
    text-align: left;
    /*float: left;*/
    line-height: 25px;
    margin-left: 22px;

}

#page_mydetails .recordset {
    width:48%;
}

.recordset h4 {
    font-size:11px;
    background-image:url(../imgs/table_bg.gif);
    background-color:#535c66;
    color:#fff;
    border-bottom:1px solid #FFFFFF;
    padding:9px;
}

.highlight {
    background-color:#f7b100;
    color:#000;
}

.highlight a, .highlight a:visited {
    color:#000;
}

#nav a:hover, #nav .active a {
    color:#f7b100;
}

#loginpage #content {
    padding-top:18px;

}
于 2013-10-21T14:34:03.373 回答