I have a table that I have been successfully able to highlight the correct cells with a selector. However the width
tag is being ignored. Can someone explain why the widths of the cells aren't affected?
Here is the jsfiddle.
HTML:
<table border="1">
<tr>
<th>ID</th>
<th>Title</th>
</tr>
<tr>
<td>Test Title</td>
<td>1</td>
</tr>
<tr>
<td>Test Title</td>
<td>1</td>
</tr>
</table>
<div class="middle">
<table border="1" width="100%">
<tr>
<th>Test Col 1</th>
<th>Test Col 2</th>
<th>Test Col 3</th>
<th>Test Col 4</th>
<th>Test Col 5</th>
<th>Test Col 6</th>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
<td>Col 4</td>
<td>Col 5</td>
<td>Col 6</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
<td>Col 4</td>
<td>Col 5</td>
<td>Col 6</td>
</tr>
</table>
</div>
<table border="1">
<tr>
<th>LINKS</th>
</tr>
<tr>
<td>LINK 1 | LINK 2</td>
</tr>
<tr>
<td>LINK 1 | LINK 2</td>
</tr>
</table>
CSS:
table { float:left; }
.middle { float:left; width:350px; overflow:auto;}
.middle table td, .middle table th { width:300px; background:red; }
width property of td and th elements is not supported at HTML5, still you can get a workaround by setting their display to inline-block and setting their width via CSS.
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