我有这个html文件
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>"This is my first page"</title>
<link href="assignment3-style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<p>
<ol style="I want the default style here">
</ol>
</p>
我想用有序列表的默认样式覆盖我的样式表设置的样式。我该如何实现?
最佳答案
更新:到目前为止,CSS 中还没有合理的方法来重置为默认样式。您将必须手动重置每个属性。
仅供引用,这是我的旧答案 - 错误 - 答案:
除非您想重置所有 <ol>
,否则请在其上放置一个特定的类,我们称它为 default-style
。
对于这个类,然后在CSS中定义
CSS:
.default-style {
all: initial;
}
<-- This will NOT work!
HTML:
<ol class="default-style">
<!-- your <li>s here -->
</ol>
如果您只想将某些 CSS 属性设置为默认值,请将 initial
设置为它们的值,例如 margin: initial;
。
关于html - 我想将我的样式表设置的样式覆盖为有序列表的默认样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30987691/