2

Why is the overflow:auto; on .pageContent breaking the layout in Chrome and Firefox? It works great in Safari. How can I go about fixing it? I added it so the clear:both; on the h2 would only clear the content and not the whole .pageAttributes div too.

Here is the site.

It looks like its the border-bottom on .selected from the menu thats causing it. Still not sure why though.

Update - Test case jsfiddle

I've tried overflow: visible; but that breaks the h2.

HTML

<div class="page">
    <div class="pageAttributes">
        .pageAttributes
    </div>
    <div class="pageMenu">
        <div class="button">View</div>
        <div class="button selected">Edit</div>
        <div class="button">Talk</div>
        <div class="search">Search:&nbsp;&nbsp;
            <input type="text" id="searchItem">
        </div>
    </div>
    <div class="pageContent">
        <h2>header</h2>
        .pageContent
        <div class="pageFooter"></div>
    </div>
</div>

CSS

html, body {
    width: 100%;
    height: 100%;
    margin: 0px;
    padding: 0px;
}

.page {
    width: 1010px;
    padding: 0 5px 0 5px;
    margin: 0 auto 30px auto;

}

.pageAttributes {
    float: left;
    width: 245px;
    height: 250px;
    margin-bottom: 20px;
    background-color: #ccc;
}

.pageMenu {
    clear: right;
    margin-left: 250px;
    height: 25px;
    margin-bottom: -1px;
    border-bottom: 1px solid #a7d7f9;
    padding-left: 1px;
    padding-right: 1px;
}

.pageMenu .button {
    float: left;
    margin-left: -1px;
    height: 24px;
    border-top: 1px solid #a7d7f9;
    border-left: 1px solid #a7d7f9;
    border-right: 1px solid #a7d7f9;
    padding-left: 15px;
    padding-right: 15px;
    text-align: center;
    line-height: 25px;
    font-family: sans-serif;
    font-size: 13px;
    cursor: pointer;
}

.pageMenu .button.selected {
    background-color: white;
    border-bottom: 1px solid white;
    cursor: default;
}

.pageMenu .search {
    float: right;
    margin-right: -1px;
    height: 24px;
    border-top: 1px solid #a7d7f9;
    border-left: 1px solid #a7d7f9;
    border-right: 1px solid #a7d7f9;
    padding-left: 15px;
    padding-right: 15px;
    text-align: center;
    line-height: 25px;
    font-family: sans-serif;
    font-size: 13px;
    cursor: default;
}

.pageContent {
    position: relative;
    border: 1px solid #a7d7f9;
    margin-bottom: 5px;
    padding: 5px;
    background-color: white;
    line-height: 1.5em;
    overflow: auto;
    clear: right;
    margin-left: 250px;
}

.pageContent h2 {
    margin-top: 25px;
    margin-bottom: 3px;
    font-size: 16px;
    border-bottom: 1px dotted #CCC;
    clear: both;
}
4

2 回答 2

1

尝试这个,

#articleSections{
    float: left;
}

overflow: auto;.pageContent

于 2013-06-19T07:25:50.217 回答
0

对我来说,这似乎是一个浮动问题,我无法在 .button(s) 和搜索输入之间清除。所以定位可能是这样的解决方案

小提琴http://jsfiddle.net/LNMH9/3/

<style type="text/css">
html, body {
    width: 100%;
    height: 100%;
    margin: 0px;
    padding: 0px;
}

.page {
    position:relative;

    width: 1010px;
    padding: 0 5px 0 5px;
    margin: 0 auto 30px auto;
}

.pageAttributes {
    position:absolute;
    left:0px;
    top:0px;
    width: 245px;
    height: 250px;
    margin-bottom: 20px;
    background-color: #ccc;
}

.pageMenu {

    margin-left: 250px;
    height: 25px;
    margin-bottom: -1px;
    border-bottom: 1px solid #a7d7f9;
    padding-left: 1px;
    padding-right: 1px;
}

.pageMenu .button {
    float: left;
    margin-left: -1px;
    height: 24px;
    border-top: 1px solid #a7d7f9;
    border-left: 1px solid #a7d7f9;
    border-right: 1px solid #a7d7f9;
    padding-left: 15px;
    padding-right: 15px;
    text-align: center;
    line-height: 25px;
    font-family: sans-serif;
    font-size: 13px;
    cursor: pointer;
}

.pageMenu .button.selected {
    background-color: white;
    border-bottom: 1px solid white;
    cursor: default;
}

.pageMenu .search {
    float: right;
    margin-right: -1px;
    height: 24px;
    border-top: 1px solid #a7d7f9;
    border-left: 1px solid #a7d7f9;
    border-right: 1px solid #a7d7f9;
    padding-left: 15px;
    padding-right: 15px;
    text-align: center;
    line-height: 25px;
    font-family: sans-serif;
    font-size: 13px;
    cursor: default;
}

.pageContent {
    position: absolute;
    width:748px;
    border: 1px solid #a7d7f9;
    margin-bottom: 5px;
    padding: 5px;
    background-color: white;
    line-height: 1.5em;
    overflow: auto;
    clear: right;
    margin-left: 250px;
}

.pageContent h2 {
    margin-top: 25px;
    margin-bottom: 3px;
    font-size: 16px;
    border-bottom: 1px dotted #CCC;
    clear: both;
}
</style>
<div class="page">
    <div class="pageAttributes">
        .pageAttributes
    </div>
    <div class="pageMenu">
        <div class="button">View</div>
        <div class="button selected">Edit</div>
        <div class="button">Talk</div>
        <div class="search">Search:&nbsp;&nbsp;
            <input type="text" id="searchItem" />
        </div>
        <div style="clear:both;"></div>
    </div>
    <div class="pageContent">
        <h2>header</h2>
        Lorem ipsum 
        <div class="pageFooter"></div>
    </div>
</div>
于 2013-06-19T07:16:50.880 回答