gpt4 book ai didi

html - 如何防止默认 css 中的 html 元素?

转载 作者:行者123 更新时间:2023-11-28 15:55:40 25 4
gpt4 key购买 nike

我对 html 和 css 有疑问。我有一个附加了 css 文件的 html 文件,在 css 文件中我有 s.th。喜欢:

    table { background: #fff; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; margin: 0 0 18px; border: 1px solid #ddd;  }

table thead, table tfoot { background: #f5f5f5; }
table thead tr th,
table tfoot tr th,
table tbody tr td,
table tr td,
table tfoot tr td { font-size: 12px; line-height: 18px; text-align: left; }
table thead tr th,
table tfoot tr td { padding: 8px 10px 9px; font-size: 14px; font-weight: bold; color: #222; }
table thead tr th:first-child, table tfoot tr td:first-child { border-left: none; }
table thead tr th:last-child, table tfoot tr td:last-child { border-right: none; }

table tbody tr.even,
table tbody tr.alt { background: #f9f9f9; }
table tbody tr:nth-child(even) { background: #f9f9f9; }
table tbody tr td { color: #333; padding: 9px 10px; vertical-align: top; border: none; }

这是默认主题。它适合所有 table 。

但现在我想在我的 web 元素中添加一个标准的非 css 格式的表,所以我写:

<table> ... </table>

此表使用 css 进行格式化。我该怎么做才能防止此表使用 css 格式化 只是以正常的默认样式显示它?

最佳答案

what can i do, to prevent this table getting formated with the css just showing it with the normal default style?

更改选择器,使其与表格不匹配。

如果 CSS 规则具有与元素匹配的选择器,则无法从 CSS 规则中排除该元素。如果您一开始就无法避免这种情况,那么您唯一的选择就是编写更多规则集,将不同的(特定的)CSS 应用于元素。

没有“重置为浏览器默认值”机制。

关于html - 如何防止默认 css 中的 html 元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8923613/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com