I have a table cell with an anchor tag and I want the width (and height) of the anchor tag to fill the width of the containing table cell. Intuition doesn't seem to work on this. Please help.
HTML:
<table>
<tr>
<td class="width_is_100px">
<a href="http://www.doesnotwork.com"><span class="make_width_100px">Some Text</span></a>
</td>
</tr>
</table>
CSS: (doesn't work)
.make_width_100px {
width:100px !important;
}
The anchor tag is only as wide as the text "Some Text". I want the user to be able to click anywhere inside the table cell and trigger the link. No javascript please.
Resize a column or table automatically with AutoFit. Automatically adjust your table or columns to fit the size of your content by using the AutoFit button. Select your table. On the Layout tab, in the Cell Size group, click AutoFit.
css: <style> li { width: 110px; height: 42px; background-color: black; } li a { width: 32px; height: 32px; color: white; } </style> html page: <li><a href="#">write something</a></li> you need to set anchor tag's display property as block :: 'display:block;' , then only it will accept values of height and width.
To prevent cells (rows) from expanding vertically, you have to set a fixed height for table rows. Select the relevant rows and, on the Table Tools Layout tab, click Properties. On the Row tab, select "Specify height" and then choose "Exactly" for "Row height is." Specify the desired amount.
Try it:
a {
display: block;
height: 100%;
width: 100%;
}
Make your <a>
element a block element (it's inline by default):
.width_is_100px a {
display:block;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With