0

我正试图让这个 CSS 工作。

jsFiddle

CSS

.GridContainer {
    width: 99%;
    height: 500px;
    border: 1px solid black;
    display: inline-table;
    padding: 0;
    margin: 0;
}
.GridContainer .TopLineContainer {
    border-bottom: 1px solid black;
    display: inline-table;
    padding: 0;
    margin: 0;
    width: 100%;
}
.GridContainer .TopLineContainer .ExtraInfoContainer {
    width: 180px;
    border-right: 1px solid black;
    display: inline-table;
    padding: 0 0 0 6px;
    margin: 0 -5px 0 0;
}
.GridContainer .TopLineContainer .GuidedNavigationContainer {
    display: inline;
    width: 100%;
    padding: 0 0 0 6px;
}
.GridContainer .BodyContainer {
    display: inline-table;
    height: 100%;
    border-bottom: 1px solid black;
    padding: 0;
    margin: 0;
    width: 100%;
    background-color: Aqua;
}
.GridContainer .BodyContainer .GuidedNavigationTreeContainer {
    float: left;
    width: 180px;
    border-right: 1px solid black;
    display: inline-table;
    padding: 0 0 0 6px;
    margin: 0 -5px 0 0;
    background-color: Red;
}
.GridContainer .BodyContainer .ContentContainer {
    float: left;
    display: inline-table;
    padding: 0 0 0 6px;
    overflow: scroll;
    background-color: Orange;
}
.GridContainer .BodyContainer .ContentContainer .ContentDataGrid {
    display: inline-table;
    width: 2400px;
}
.ContentDataGrid .ContentDataGridHeader { display: inline-table }
.ContentDataGrid .ContentDataGridHeader .Column { display: inline-table }

HTML

<div class="GridContainer">
    <div class="TopLineContainer">
        <div class="ExtraInfoContainer">
            Extra info container
        </div>
        <div class="GuidedNavigationContainer">
            guided nav container
        </div>
    </div>
    <div class="BodyContainer">
        <div class="GuidedNavigationTreeContainer">
            guided nav item list
        </div>
        <div class="ContentContainer">
            <div class="ContentDataGrid">
                sadfasd fasdf gadsfgkjh asdlfkgjhsdlkjfgh sldkfjhg sadfasd fasdf gadsfgkjh asdlfkgjhsdlkjfgh sldkfjhg sadfasd fasdf gadsfgkjh asdlfkgjhsdlkjfgh sldkfjhg sadfasd fasdf gadsfgkjh asdlfkgjhsdlkjfgh sldkfjhg sadfasd fasdf gadsfgkjh asdlfkgjhsdlkjfgh sldkfjhg
            </div>
        </div>
    </div>
</div>

但是,正如您在 jsFiddle 中看到的那样,橙色部分不会出现在红色旁边,并且其父级不会滚动。

所以应该发生的是红色在左边,橙色在右边,当内容超出父级时,蓝色应该滚动橙色。

4

1 回答 1

0

查看您希望如何将数据布局为网格。<table>在这种情况下最好使用 a 。

HTML:

<table class="table-grid">
    <tr><th>Extra info container</th><th>guided nav container</th></tr>
    <tr>
        <td class="extra-info-cell">guided nav item list</td>
        <td class="guided-nav-cell">
            sadfasd fasdf gadsfgkjh asdlfkgjhsdlkjfgh sldkfjhg sadfasd fasdf gadsfgkjh asdlfkgjhsdlkjfgh sldkfjhg sadfasd fasdf gadsfgkjh asdlfkgjhsdlkjfgh sldkfjhg sadfasd fasdf gadsfgkjh asdlfkgjhsdlkjfgh sldkfjhg sadfasd fasdf gadsfgkjh asdlfkgjhsdlkjfgh sldkfjhg
        </td>
    </tr>
</table>

CSS:

.table-grid { border: 1px solid black; padding:0; margin:0; }
.table-grid th {line-height: 18px; padding:2px; }
.table-grid td {line-height: 18px; background: cyan; vertical-align:top; padding:5px; }
.table-grid .extra-info-cell { background: red; width: 160px; }

jsFiddle:http: //jsfiddle.net/DXg7M/2/

于 2013-07-01T01:31:12.887 回答