HTML / CSS:内容增长超过960网格

时间:2012-04-27 11:33:11

标签: html css 960.gs

我使用的是960 Grid Systemcontainer_16格式。出于某种原因,我的一个容器略大于其他容器。这是在杀死我的风水。

我在这里突出显示错误:

error

可以在http://rcnhca.org.uk/sites/first_steps/看到实时预览,请注意顶部的面包屑如何比任何其他元素更靠右几个像素?

guilty元素具有以下标记:

<div class="container_16">
                <div class="grid_16" id="breadcrumbs">

                    <a href="http://rcnhca.org.uk/sites/first_steps" id="home"></a>
                    <ul id="parent" class="grid_15 omega">
                    <li><a href="http://rcnhca.org.uk/sites/first_steps/">Select a topic</a><ul class="child"><li><a href="http://rcnhca.org.uk/sites/first_steps/getting-started/">Getting started</a></li><li><a href="http://rcnhca.org.uk/sites/first_steps/communication/">Communication</a></li><li><a href="http://rcnhca.org.uk/sites/first_steps/health-safety-and-security/">Health, Safety and Security</a></li><li><a href="http://rcnhca.org.uk/sites/first_steps/personal-and-people-development/">Personal and people development </a></li><li><a href="http://rcnhca.org.uk/sites/first_steps/quality/">Quality</a></li><li><a href="http://rcnhca.org.uk/sites/first_steps/equality-diversity-and-rights/">Equality, diversity and rights </a></li><li><a href="http://rcnhca.org.uk/sites/first_steps/clinical-skills/">Clinical skills</a></li><li><a href="http://rcnhca.org.uk/sites/first_steps/additional-material/">Additional material</a></li></ul></li>                      </ul>
                </div>

                <div id="supplements" class="grid_16">
                    <div class="left">
                        <a href="#" class="button alpha"><img src="http://rcnhca.org.uk/sites/first_steps/wp-content/themes/megaamazing/library/images/book-icon.png" alt="book icon">View competencies checklist</a>
                    </div>
                    <div class="right">
                        <a href="#" class="button alpha bold"><img src="http://rcnhca.org.uk/sites/first_steps/wp-content/themes/megaamazing/library/images/rcn-icon.png" alt="rcn icon">Join the RCN</a>
                        <a href="#" class="button omega">Reasons to joins</a>

                    </div>
                </div>
            </div>

它是CSS:

#breadcrumbs {
    display: block;
    position: relative;
    z-index: 4;
    height: 39px;
    padding-bottom: 3px;
    background: #ffffff;
    border: 0px solid;
    border-left: #3a90a7 2px solid;
    border-right: #3a90a7 2px solid;
    border-bottom: #3a90a7 2px solid;
    -webkit-border-bottom-left-radius: 5px;
    -webkit-border-bottom-right-radius: 5px;
    -moz-border-radius-bottomleft: 5px;
    -moz-border-radius-bottomright: 5px;
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
}

#breadcrumbs ul {
    list-style: none; 
    list-style-image: none; 
    margin: 0;
}

#breadcrumbs #home{
    display: block;
    height: 39px;
    width: 60px;
    float: left;
    background-image: url(library/images/home_icon.png);
    background-repeat: no-repeat;
    background-position: 19px center;   
    text-indent: -999em;
}

#breadcrumbs ul#parent {
    display: block;
    height: 39px;
    float: right;
    right: 3px;
    position: relative;
    background: #f38630;
    -webkit-box-shadow: inset 0px -2px 0px 0px #cf7229;
    -moz-box-shadow: inset 0px -2px 0px 0px #cf7229;
    box-shadow: inset 0px -2px 0px 0px #cf7229;
    -webkit-border-bottom-left-radius: 5px;
    -webkit-border-bottom-right-radius: 5px;
    -moz-border-radius-bottomleft: 5px;
    -moz-border-radius-bottomright: 5px;
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
}

#breadcrumbs ul#parent li {
    position: relative;
    height: 39px;
    float: left;
    min-width: 1px; /* required to fix Opera bug */
    padding: 0 47px 0 15px;
    background-image: url(library/images/breadcrumb_seperator.png);
    background-repeat: no-repeat;
    background-position: right;
    line-height: 39px;
    zoom: 1;
}

#breadcrumbs ul#parent li a {
    display: block;
    height: 42px;
    position: relative;
    font-size: 15px;
    font-weight:900;
    color: #ffffff;
    text-decoration: none;
    text-shadow: 0px 2px 0px #cf7229;
}

#breadcrumbs ul li a:visited {
    color: #ffffff;
}
#breadcrumbs ul#parent li:first-child ul {
    left: -5px;
}
#breadcrumbs ul#parent li ul {
    position: absolute;
    z-index: 9998;
    left: -28px;
    top: 42px;
    background: #ffffff;
    border-left: #3a90a7 2px solid;
    border-right: #3a90a7 2px solid;
    border-bottom: #3a90a7 2px solid;
    -webkit-border-bottom-left-radius: 5px;
    -webkit-border-bottom-right-radius: 5px;
    -moz-border-radius-bottomleft: 5px;
    -moz-border-radius-bottomright: 5px;
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
    padding: 0 3px 0 3px;
    list-style-position: outside;
    min-width: 200px;
    width: auto;
    -webkit-box-shadow: 0px 6px 6px -6px rgba(0, 0, 0, 0.5);
    -moz-box-shadow: 0px 6px 6px -6px rgba(0, 0, 0, 0.5);
    box-shadow: 0px 6px 6px -6px rgba(0, 0, 0, 0.5);
}

.js #breadcrumbs ul#parent li ul {
    display:none;
}

.no-js #breadcrumbs ul#parent li ul {
    left: -999em;
}

#breadcrumbs ul#parent li ul li {
    float: none;
    display: block;
    position: relative;
    height: 26px;
    margin-bottom: 3px;
    padding: 0 15px;
    background-image: url(library/images/arrow-icon.png);
    background-position: -25px 50%;
    background-repeat: no-repeat;
    background-color: #738793;
    border-radius: 5px; 
    -moz-border-radius: 5px; 
    -webkit-border-radius: 5px;
    line-height: 26px;
    white-space: nowrap;
    zoom: 1;
}

#breadcrumbs ul#parent li ul li a{
    display: block;
    width: auto;
    color: #ffffff;
    text-decoration: none;
    text-shadow: none;
    font-weight: 100;
}

#breadcrumbs ul#parent li ul li.active, #breadcrumbs ul#parent li ul li:hover{
    background-color: #3393b5;
}

#breadcrumbs ul#parent li ul li.active, .no-js #breadcrumbs ul#parent li ul li:hover{
    background-position: 0px 50%;
    text-indent: 10px;
}

.no-js #breadcrumbs ul#parent li:hover ul, .no-js #breadcrumbs ul#parent li:focus ul {
    left: -5px;
}

任何人都可以帮我把它塑造成形状吗?

1 个答案:

答案 0 :(得分:1)

这是因为您已为#breadcrumbs提供了额外4px宽度的边框。

border-left: #3a90a7 2px solid;
border-right: #3a90a7 2px solid;`.

grid_16实际上是944px而不是预期的940px,因此存在差异。

你需要重新调整你的标记。

<div class="grid_16">
<div id="breadcrumbs">
<!-- etc -->
</div>
</div>

您还必须调整home按钮的大小。给它一个grid_1 alpha类并从CSS中删除width:54px。应该好好去