On browsers like Safari and Firefox, the table
width
isn’t shown 100% in Reader View Mode
. But if I add <table width="100%">
, HTML
validators flag it as an obsolete element. Adding styles
won’t work as Reader View Mode
strips CSS
. Tried using inline styles
for the table
but that too is stripped away in Reader View Mode
.
How to resolve this issue?
My code for table
:
<table width="100%">
<caption>The table below shows nutritional values per serving without the additional fillings.</caption>
<tbody>
<tr>
<td>Calories</td><td>227kcal</td>
</tr>
<tr>
<td>Carbs</td><td>0g</td>
</tr>
<tr>
<td>Protein</td><td>20g</td>
</tr>
<tr>
<td>Fat</td><td>22g</td>
</tr>
</tbody>
</table>
3
Answers
Just checked in Google Chrome, using a CSS class will do the trick, for example:
and of course, don’t forget to add the
class="tbl_reader"
to thetable
tag.You can use
colgroup
tag. Thecolgroup
is very useful to apply styles to all columns in table. I provide updated code usingcolgroup
.You can add a class to the table and width: 100% to the class.
This should solve.
CSS:
Also, the width attribute is deprecated.
A simple google search –