Tôi có một bảng bên trong một <div>
:Chuyển đổi chiều rộng từ phần trăm pixel
<div id="fixeddiv">
<table id="fixedtable">
<tr class="firstrow">
<td class="td11"></td>
<td class="td12"></td>
<td class="td13"></td>
</tr>
<tr class="secondrow">
<td class="td21" style="width:10%"></td>
<td class="td22" style="width:20%"></td>
<td class="td23" style="width:70%"></td>
</tr>
</table>
</div>
CSS:
#fixeddiv
{
overflow:auto;
margin:0px;
padding:0px;
position: relative;
text-align:left;
width: 48%;
}
#fixedtable
{
background-color: White;
border-spacing:0px;
cursor: pointer;
width: 100%;
height: 100%;
font-family: Calibri !important;
color: Black;
font-size: 14px;
}
.firstrow
{
position: absolute;
margin: 0px;
left: 0;
top: 0;
background: url(../Content/Images/header.jpg) repeat-x center top;
color: White;
font-weight: bold;
text-align: center;
}
#fixedtable tr td
{
padding: 5px !important;
border: 1px solid #FFFFFF;
text-align: center;
}
Tôi đang tính toán độ rộng của td21
với $('.td21').width()
và gán chiều rộng để td11
như $('td11').width($('.td21').width())
.
Vấn đề là chiều rộng áp dụng không giống nhau, chúng thay đổi theo 1px
và tôi không thể tìm thấy sự khác biệt này xảy ra như thế nào 1px
. Chiều rộng .td21
là 1px
lớn hơn .td11
.
Có thể ai giúp tôi tìm giải pháp không?
luôn lớn hơn 1 px? Tại sao không chỉ -1 đến giá trị) – Feanor