当用户单击“登录”时,我正在使用jQuery将登录框向下滑动。单击后,我希望整个页面(包括徽标)向下滑动。到目前为止,除徽标外,页面确实向下滑动。您可以在此处查看页面:

http://mini.lukedude5.com

单击“登录”或“注册”时,页面主体向下滑动(将下边距设置为500px来放大它)。但是,正如您所看到的,徽标“ mi.ni”不会向下滑动。

<div id = 'header'>
    <a href = '/' title = 'mi.ni' id = 'logo'>mi.ni</a>
</div>


上面是徽标的HTML,下面是CSS。

#wrapper
{
    width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

#wrapper #header
{
    height: 100px;
    width: 260px;
    background: url('/styles/images/logo2.png') no-repeat;
    margin: 20px auto 0px auto;
}

#wrapper #header #logo
{
    height: 100px;
    width: 260px;
    display: block;
    text-indent: -9999px;
}


标头包装在包装器中。登录框从其向下滑动的条不在包装纸内。

登录/登录框的CSS为:

#topBar #signIn, #signUp
{
    width: 250px;
    float: right;
    color: #FFF;
    margin-top: 5px;
    font-weight: bold;
    display: none;
    margin-bottom: 500px;
}


感谢您对此问题的任何帮助!

编辑:栏的HTML跨越页面的顶部。

<div id = 'topBarWrapper'>
        <div id = 'topBar'>
            <div id = 'mainTop'>
                mi.ni is a URL shortening service. Learn more about mi.ni. I am trying my hardest to get the domain http://mi.ni.
            </div>
            <div id = 'rightTop'>
                <span id = 'signInText'>Sign In</span>
                |
                <span id = 'signUpText'>Sign up</span>
            </div>
            <div id = 'signIn'>
                <form action = '' method = 'POST'>
                    <table>
                        <tr>
                            <td>Username:</td>
                            <td><input type = 'text' name = 'username' id = 'usernameSignIn' class = 'input' /></td>
                        </tr>
                        <tr>
                            <td>Password:</td>
                            <td><input type = 'password' name = 'password' id = 'passwordSignIn' class = 'input' /></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td><div class = 'signInSubmit'></div></td>
                        </tr>
                    </table>
                </form>
            </div>
            <div id = 'signUp'>
                <form action = '' method = 'POST'>
                    <table>
                        <tr>
                            <td>Username:</td>
                            <td><input type = 'text' name = 'username' id = 'usernameSignUp' class = 'input' /></td>
                        </tr>
                        <tr>
                            <td>Email:</td>
                            <td><input type = 'text' name = 'email' id = 'emailSignUp' class = 'input' /></td>
                        </tr>
                        <tr>
                            <td>Password:</td>
                            <td><input type = 'password' name = 'password' id = 'passwordSignUp' class = 'input' /></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td><div class = 'signUpSubmit'></div></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
    </div>


栏的CSS:

#topBarWrapper
{
    width: 100%;
    height: 25px;
    padding-top: 5px;
    background: #000;
    color: #FFF;
}

#topBar
{
    width: 1050px;
    margin-left: auto;
    margin-right: auto;
}

#topBar #mainTop
{
    display: inline;
}

#topBar #rightTop
{
    display: inline;
    margin-left: 50px;
    font-weight: bold;
}

#topBar #rightTop #signInText
{
    cursor: pointer;
    margin-right: 5px;
}

#topBar #rightTop #signUpText
{
    cursor: pointer;
    margin-left: 5px;
}

#topBar #signIn, #signUp
{
    width: 250px;
    float: right;
    color: #FFF;
    margin-top: 5px;
    font-weight: bold;
    display: none;
    margin-bottom: 500px;
}

最佳答案

在wrapper div上都设置clear:both。那里正在倒塌。

#wrapper {
width: 1000px;
margin-left: auto;
margin-right: auto;
clear: both;
}

10-02 19:32