Reputation: 485
How to make inside table same size as text inside :
<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%;
}
How to make <div class="block" id="block-1" style="background: black">
take size of
<a style="color: black" href="myFunc()"> <c:out value="${item.title}"/> </a>
Upvotes: 1
Views: 97
Reputation: 4503
use display: inline-block;
for .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>
Upvotes: 1