0

我有一个关于 HTML 表格的问题。我使用 Divs 创建了 HTML 表格。一些单元格包含图像,因此它们具有固定大小。底部单元格可根据其他框中填写的数据调整大小。所以,我不想在这个溶液中使用绝对选项。这是我的代码:

    <!DOCTYPE html>
<html>
<header>
<style type="text/css">


object
{
    outline:  none;
    display:block;
}
html, body {
    margin:0; padding:0;
    height:100%;
}

.divTable
{
    width: 135px;
    height: 100%;
    display: table;
    float:left;
    background-color:blue;
}
.newDiv{
    position: relative;
    left:135px;
    height:100%;
    width:100%;
    display: block;
    background-color:yellow;
    border:1px solid #BBBDBF;
    border-left:0px;
}
.divTableRow
{
    width: 135px;
    height: 30px;
    display: table-row;
}


.divTableCell
{
    width: 135px;
    height: 30px;
    background: white url('Images/bottom_up.png') 0 0 no-repeat;
    display: table-cell;
    text-align:center;
    vertical-align:middle;
}

.divTableTopCell
{
    width: 135px;
    height: 30px;
    background: white url('Images/top_up.png') 0 0 no-repeat;
    display: table-cell;
    text-align: center;
    border-bottom:1px solid #848385;
    vertical-align:middle;

}
.divTableBottomBox
{
    position:relative; 
    width: 133px;
    height: 100%;
    background-color: #d0d2d3;
    display: block;
    border:1px solid #BBBDBF;
    clear:both;
    }
.divParent{
position: relative;
display:block;
min-height:700px;
min-width:700px;
}

</style>
</header>
<body>
<div class='divParent'>
<div class="divTable">
        <div class="divTableRow">
            <div  id = 'accountDetails' class="divTableTopCell">
                Account Details
            </div>
        </div>
        <div class="divTableRow">
            <div id = 'locations' class="divTableCell">
                Locations
            </div>
        </div>
          <div class="divTableRow">
            <div id = 'users' class="divTableCell">
                Users
            </div>
        </div>
          <div class="divTableRow">

            <div id = 'training' class="divTableCell">
                Training
            </div>
            </div>

          <div class="divTableRow">

            <div id = 'contracts' class="divTableCell">
                Contracts
            </div>
            </div>
            <div class='divTableBottomBox'>
            </div>
   </div>
   <div class='newDiv'>
    Helllo <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
</div>
</div>
</body>
</html>

任何帮助,将不胜感激。

4

2 回答 2

0

从外观上看,您正在标记表格数据。如果您有表格表格,则使用实际的 HTML 表格在语义上是正确的。你不应该试图用 div 来伪造它。它们不太适合这项任务并且在语义上是无效的。

于 2013-06-09T06:09:23.147 回答
0

感谢您的答复。我修好了它。

这是解决方案:

<!DOCTYPE html>
<html>
<header>
<style type="text/css">


object
{
    outline:  none;
    display:block;
}
html, body {
    margin:0; padding:0;
    height:100%;
}

.divLeftContainer{
    min-height:100%;
    height:100%;
    display:block;
    background-color:red;
    float:left;
}
.divTable
{
    float:left;
    width: 135px;
    height: auto;
    display: table;
    background-color:blue;
}
.newDiv{
    position: relative;
    left:135px;
    height:100%;
    width:100%;
    display: block;
    background-color:yellow;
    border:1px solid #BBBDBF;
    border-left:0px;
}
.divTableRow
{
    width: 135px;
    height: 100%;
    display: table-row;
    border:0px;
}


.divTableCell
{
    width: 135px;
    height: 30px;
    background: white url('Images/bottom_up.png') 0 0 no-repeat;
    display: table-cell;
    text-align:center;
    vertical-align:middle;
}

.divTableTopCell
{
    width: 135px;
    height: 30px;
    background: white url('Images/top_up.png') 0 0 no-repeat;
    display: table-cell;
    text-align: center;
    border-bottom:1px solid #848385;
    vertical-align:middle;

}
.divTableBottomBox
{
    width: 133px;
display:block;
height:100%;
    background-color: #d0d2d3;
    border:1px solid #BBBDBF;
    border-top:0px;
    margin-bottom:0px;
    bottom:0px;
    }
.divParent{
position: relative;
display:block;
height:700px;
min-height:700px;
min-width:700px;
}

</style>
</header>
<body>
<div class='divParent'>
<div class='divLeftContainer'>

<div class="divTable">
        <div class="divTableRow">
            <div  id = 'accountDetails' class="divTableTopCell">
                Account Details
            </div>
        </div>
        <div class="divTableRow">
            <div id = 'locations' class="divTableCell">
                Locations
            </div>
        </div>
          <div class="divTableRow">
            <div id = 'users' class="divTableCell">
                Users
            </div>
        </div>
          <div class="divTableRow">

            <div id = 'training' class="divTableCell">
                Training
            </div>
            </div>

          <div class="divTableRow">

            <div id = 'contracts' class="divTableCell">
                Contracts
            </div>
            </div>

   </div>
    <div class='divTableBottomBox'>
    </div>
   </div>
   <div class='newDiv'>
    Helllo <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
</div>
</div>
</body>
</html>
于 2013-06-09T22:29:42.693 回答