2

我有网站,其周围有 15 像素的黑边,如图所示

在此处输入图像描述

问题是当我按宽度扩展浏览器窗口时,这个间隙变得更大,如下所示

在此处输入图像描述

我一直在尝试让这个宽度保持在 15 像素,但我就是不知道问题出在哪里。我已经使用了 FireBug 提供的所有工具,但无济于事。有人对我可能尝试的方法有什么建议吗?

通过消除过程,我已经能够缩小这个 CSS 中的错误范围

/*----------------------------------------------------------------------*/
/* Login
/*----------------------------------------------------------------------*/

body#login{
    position:static;
    left:auto;
    right:auto;
    width:350px;
    margin:120px auto;
    padding:2%;
}
body#login #content{
    min-height:50px;
    padding:8px;
}
body#login form label{
    padding:0;
    margin:0;
    width:100%;
}
body#login form section{
    width:100%;
}
body#login form section div{
    width:90%;
    float:none;
    padding:0 4% 6px 4%;
    border:0;
}
body#login form section > div{
    width:90% !important;
}
body#login form section div input{
    width:100% !important;
}
body#login form section div input#remember{
    width:auto !important;
}
body#login form section div.checker{
    width:auto !important;
    padding:0;
    margin:0;
}
body#login form section label{
    padding:3% 2% 1%;
    width:90% !important;
    float:none;
}
body#login form section label.checkbox div{
    width:10px;
    padding:0;
    margin:0;
}
body#login form section a{
    float:right;
}

/*----------------------------------------------------------------------*/
/* Wizard
/*----------------------------------------------------------------------*/

body#wizard{
    position:static;
    left:auto;
    right:auto;
    width:500px;
    margin:120px auto;
    padding:0;
}
body#wizard #content{
    min-height:50px;
    padding:8px;
}


/*----------------------------------------------------------------------*/
/* Media Queries
/*----------------------------------------------------------------------*/

/* For very large screens increes the margins*/
@media screen and (min-width:1281px) {
body{
    margin-left:10%;
    margin-right:10%;
}
}

/* Move the Headernav to a drop down menu to the right */
@media screen and (max-width:960px) {
#header ul#headernav li ul, #header ul#headernav li ul.collapsed{
    display:none;
}
#header ul#headernav li ul.shown{
    display:block !important;
}
#header ul#headernav{
    border-left:1px solid;
    position:relative;
    float:right;
    height:60px;
    width:60px;
    cursor:pointer;
    background-repeat:no-repeat;
    background-position:center center;
}

#header ul#headernav li ul{
    position:absolute;
    right:0;
    width:170px;
    padding:0;
    margin:0;
    top:60px;
}
#header ul#headernav li ul li{
    float:none;
    margin:0;
    border-bottom:0;
    border-top:0;

}
#header ul#headernav li ul li a{
    padding:10px;   
}
#header ul#headernav li ul li:last-child{
    border-bottom:1px solid;

}
#header ul#headernav li ul span{
    right:5px;
    top:10px;
}
#header ul#headernav li ul li ul{
    position:relative;
    top:0;
    padding:0;
    display:none;
    padding-bottom:6%;
    z-index:20;
    width:99%;
}
#header ul#headernav li ul li ul.shown{
    display:block;
}
#header ul#headernav li ul li ul li{
    margin:0 6%;
}
#header ul#headernav li ul li ul li a{
    font-size:12px;
    padding:5px;
}

.g1,.g2,.g3,.g4,.g5,.g6 {
    padding:0;
    width:48.0%;
}
.g7,.g8,.g9,.g10,.g11,.g12 {
    padding:0;
    width:98%;
}
}
@media screen and (max-width:900px) and (min-width:701px) {
    form fieldset > section > div{
        width:69%;
    }
    form fieldset > section label{
        width:24%;
    }
}

/* For more smaller Screens (iPad) */
@media screen and (max-width:700px) {
    header #search,header #searchbox{
        max-width:100px;
    }
    form label{
        padding:10px 1%;
    }
    form fieldset > section{
        padding-bottom:8px;
    }
    form fieldset > section > label{
        left:0;
        right:0;
        width:98%;
        margin:0;
        float:none;
        padding:1%;
        padding-bottom:8px;
    }
    form fieldset > section > div{
        float:none;
        width:98%;
        padding:4px;
        border:0;
    }
    .g1,.g2,.g3,.g4,.g5,.g6,.g7,.g8,.g9,.g10,.g11,.g12 {
        width:98%;
    }
}
@media screen and (max-width:800px) and (min-width:481px) {
    nav{
        width:150px;
    }
    nav ul li a span{
        font-size:12px;
    }
    nav ul li ul{
        margin-left:10px;
        margin-right:10px;
    }
    nav ul li ul li a span{
        padding-right:4px;
    }
    #content{
        padding:15px 0 15px 160px;
    }

    #header ul li ul li,#header ul li ul li a, #header ul#headernav li ul li ul{
        -webkit-border-radius:0; -moz-border-radius:0; border-radius:0;
    }

    #header ul li ul li:last-child,#header ul li ul li:last-child a{
        -webkit-border-bottom-left-radius:4px; -moz-border-radius-bottomleft:4px; border-bottom-left-radius:4px;
    }

}

/* iPhone and real small devicces */
@media screen and (max-width:480px) {
    body#login{
        position:static;
        left:auto;
        right:auto;
        width:96%;
        margin:10px auto;
        padding:0;
    }
    body#login #content{
        padding:0;
        padding-top:20px;
        width:99%;
    }
    body#login form{
        border:0;
    }
    body#login form section label{
        border:0;
    }
    body#login fieldset{
        margin:0px;
    }
    body#login form > section a{
        margin:10px 4%;
        float:left;
    }
    #pageoptions > div{
        left:2px;
        right:2px;
        padding:15px;
    }
    header #searchbox{
        display:none;
        max-width:40px;
    }
    header #searchbox input{
        max-width:40px;
    }
    body{
        width:96%;
        margin:1%;
    }
    body, header, nav, #content{
        -webkit-box-shadow:none;
        -moz-box-shadow:none;
        box-shadow:none;
    }
    #header{
    }
    #logo{
        width:100%;
    }
    #logo, header, #content{
        width:100%;
    }
    nav, nav ul, nav ul li, nav ul li a, nav ul li a span, nav ul li a:active span, nav ul li a.active span{
        margin:0;
        padding:0;
    }
    nav ul li a:active span, nav ul li a.active span{
        border-top:1px solid;
        background-position:center center;
    }
    nav{
        border-top:1px solid;
        position:static;
        width:98%;
        margin:0 1%;
    }
    nav ul li{
        width:44px;
        display:inline-block;
        margin-left:-2px;
        margin-right:-2px;
    }
    nav ul li a span{
        border-left:1px solid;
        border-bottom:0;
        height:40px;
        text-indent:-9999px;
        background-position:center center;
    }
    nav ul li:first-child a span{
        border-left:0;
    }
    nav ul li ul{
        position:absolute;
        left:0;
        margin:0;
        z-index:15;
        background:none;
        width:98%;
        margin:0 1%;
    }
    nav ul li ul li{
        display:block;
        width:100%;
    }
    nav ul li ul li a span{
        height:20px;
        text-indent:0;
    }

    #content{
        padding:0;
    }
    form{
        padding:0;
        margin:0;
    }
    form input, form textarea{
        font-size:14px;
        max-width:96%;
    }
    #wl_msg{
        right:5px;
        left:5px;
        width:auto;
    }
    .g1,.g2,.g3,.g4,.g5,.g6,.g7,.g8,.g9,.g10,.g11,.g12 {
        width:100%;
        margin:0;
    }
}

谁能发现问题?

谢谢。

萨钦

4

2 回答 2

2

尝试设置最大宽度的适当性,并将溢出隐藏到您的黑色背景中。我希望这会有所帮助。

费尔乔

于 2012-05-16T15:29:11.220 回答
0

问题就在这里

/* For very large screens increes the margins*/
@media screen and (min-width:1281px) {
body{
    margin-left:10%;
    margin-right:10%;
}
}
于 2012-05-16T15:45:02.223 回答