我有一张我遇到问题的桌子。我希望两个表在 Div 中并排宽度相等。我试图手动设置宽度等,但没有成功,任何帮助都很好。
目前看起来像这样
html
<div class = "CoresAreaDiv">
<label class="CoresLabel">CoreShop</label>
<table class="CoreShopTable" >
<tr>
<th>
L1
</th>
<td>@ViewData["L1"]</td>
</tr>
<tr>
<th>L2</th>
<td>@ViewData["L2"]</td>
</tr>
<tr>
<th>L3</th>
<td>@ViewData["L3"]</td>
</tr>
<tr>
<th>L4</th>
<td>@ViewData["L4"]</td>
</tr>
<tr>
<th>L5</th>
<td>@ViewData["L5"]</td>
</tr>
<tr>
<th>L6</th>
<td>@ViewData["L6"]</td>
</tr>
<tr>
<th>L7</th>
<td>@ViewData["L7"]</td>
</tr>
<tr>
<th>L8</th>
<td>@ViewData["L8"]</td>
</tr>
</table>
<table class="CoreShopTable2">
<tr>
<th>L9</th>
<td>@ViewData["L9"]</td>
</tr>
<tr>
<th>L10</th>
<td>@ViewData["L10"]</td>
</tr>
<tr>
<th>L11</th>
<td>@ViewData["L11"]</td>
</tr>
<tr>
<th>L12</th>
<td>@ViewData["L12"]</td>
</tr>
<tr>
<th>L13</th>
<td>@ViewData["L13"]</td>
</tr>
<tr>
<th>L14</th>
<td>@ViewData["L14"]</td>
</tr>
<tr>
<th>L15</th>
<td>@ViewData["L15"]</td>
</tr>
<tr>
<th>L18</th>
<td>@ViewData["L18"]</td>
</tr>
</table>
</div>
下面的CSS代码是
.CoresAreaDiv
{
width:50%;
}
}
table.CoreShopTable
{
text-align: left;
margin: 45px;
border-collapse: collapse;
font-family: "Lucida Sans Unicode" , "Lucida Grande" , Sans-Serif;
width: 20%;;
position: relative;
float: left;
}
table.CoreShopTable th
{
width: 2%;
font-weight: normal;
padding: 8px;
background: #b9c9fe url('table-images/gradhead.png') repeat-x;
border-top: 2px solid #d3ddff;
border-bottom: 1px solid #fff;
color: #039;
font-size: larger;
font-weight: bolder;
text-align: center;
}
table.CoreShopTable td
{
padding: 8px;
border-bottom: 1px solid #fff;
color: #669;
border-top: 1px solid #fff;
background: #e8edff url('table-images/gradback.png') repeat-x;
font-size: larger;
text-align: center;
width: 2%;
}
table.CoreShopTable td:hover
{
background: #d0dafd url(C:\Users\pbrady\Desktop\Code\MvcApplication1\MvcApplication1\Images\gradhover.png);
color: #339;
}
table.CoreShopTable2
{
text-align: left;
margin: 45px;
border-collapse: collapse;
font-family: "Lucida Sans Unicode" , "Lucida Grande" , Sans-Serif;
width: 50px;
float: right;
right: -50px;
top: -357px;
position: relative;
}
table.CoreShopTable2 th
{
width: 20%;
font-weight: normal;
padding: 8px;
background: #b9c9fe url('table-images/gradhead.png') repeat-x;
border-top: 2px solid #d3ddff;
border-bottom: 1px solid #fff;
color: #039;
font-size: larger;
font-weight: bolder;
text-align: center;
}
table.CoreShopTable2 td
{
padding: 8px;
border-bottom: 1px solid #fff;
color: #669;
border-top: 1px solid #fff;
background: #e8edff url('table-images/gradback.png') repeat-x;
font-size: larger;
text-align: center;
}