如何在 Safari/Firefox 阅读器模式下将表格宽度设置为 100%?

问题描述 投票:0回答:1

在 Safari 和 Firefox 等浏览器上,

table
width
Reader View Mode
中不会 100% 显示。但如果我添加
<table width="100%">
HTML
验证器会将其标记为过时元素。添加
styles
不会起到
Reader View Mode
条带
CSS
的作用。尝试使用
inline styles
代替
table
,但这也被
Reader View Mode
中删除了。

如何解决这个问题?

我的代码

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>

html css accessibility
1个回答
0
投票

刚刚在 Google Chrome 中检查过,使用 CSS 类就可以解决问题,例如:

.tbl_reader {
    width: 100%;
}

当然,不要忘记将

class="tbl_reader"
添加到
table
标签。

© www.soinside.com 2019 - 2024. All rights reserved.