html - :before 不用于 Firefox 中的表格
问题描述
我在 Firefox 下放置表格时遇到问题。该代码在 chrome 和 safari 下运行良好。
可以在此处看到问题的“实时”版本, 但下图显示了问题。
插入表格的html代码的开始/结束如下所示,这是一个标准的html表格
<table>
<thead>
<tr class="header">
<th align="left">Navn</th>
<th align="left">Gruppe</th>
<th align="right">odds</th>
<th align="right">ELO</th>
<th></th>
....
</tr>
</tbody>
</table>
问题出现在 css 中的边距/宽度定义。相关代码如下图
table, table.booktabs {
/* making booktabs style tables the unstyled default in case someone uses Markdown styling */
width: auto;
margin: auto;
border-spacing: 0px;
border-top: 2px solid #333;
border-bottom: 2px solid #333;
}
如果调整边距或宽度,则调整表格的宽度和位置,但不保留布局的列部分。左列(以及表格)的宽度在表格之前使用
table:before {
width: 61%;
display: inline-block;
}
但是那段代码在firefox下没有width: 61%;
效果,所以从来没有设置宽度。有人可以告诉我为什么并提供可以跨浏览器工作的替代解决方案吗?哦,和它一样::before
。
解决方案
如果你想使用pseudo
你:before
必须设置content
例如:
table:before {
content:"";
width: 61%;
display: inline-block;
}
在这里学习:https ://developer.mozilla.org/en-US/docs/Web/CSS/::before
推荐阅读
- ssis - 获取上一行的数据并计算 SSIS 脚本组件中的增长
- django - Django - 使用 `@api_view` 将 Django Rest Swagger 模式添加到 DRF 标记函数
- ios - 当我启动系统拍照时,ios画中画变暗
- python - 在 Google Colab 上使用 spacy 训练 NER
- python - 如何使用输入不同的文件和输出不同的文件运行相同的代码?与 SAS 宏相同
- python - 如何根据条件拆分一些减号运算符?
- node.js - 使用 res.header express node js 的数组的正确方法是什么
- java - 在 spring-integration 中使用 payload-type-router 使用 List Generic payload 路由消息
- django - FileNotFoundError:[Errno 2] 没有这样的文件或目录:'pyerp-master/installed_apps.py'
- c# - 过滤 BindingSource 后,在 DataGridView 中保持数据突出显示(选中)