如何使内部表格与文本内部相同:
<table class="table-1">
<tr>
<td align="center">
<div class="block" id="block-1" style="background: black">
<a style="color: black" href="myFunc()"><c:out
value="${item.title}" /></a>
</div>
</td>
</tr>
</table>
的CSS:
table.table-1 {
width: 100%;
}
如何使<div class="block" id="block-1" style="background: black">
取大小
<a style="color: black" href="myFunc()"> <c:out value="${item.title}"/> </a>
答案 0 :(得分:1)
将display: inline-block;
用于.block
table.table-1 {
width: 100%;
}
.block{
display: inline-block;
}
<table class="table-1">
<tr>
<td align="center">
<div class="block" id="block-1" style="background: black">
<a style="color: #fff" href="myFunc()">text text text</a>
</div>
</td>
</tr>
</table>