是否可以在 html 中加载外部 css “特定的一些行”?
例如:我有一个带有一些 div 的页面,我希望页面从 css 加载仅特定的一些行,而不是整个 css,请参见下面的代码片段。有没有办法显示仅 div1 和div2 样式,而不是所有四个?
.class1 {
background-color:#FC0;
width:300px;
height:50px;
}
.div1 {
background-color:#CCC;
width:300px;
height:50px;
}
.class2 {
background-color:#F00;
width:300px;
height:50px;
}
.div2 {
background-color:#FFC;
width:300px;
height:50px;
}
<div class="class1">class1 text (I don't want this css)</div>
<div class="div1">div1 text</div>
<div class="class2">class2 text (I don't want this css)</div>
<div class="div2">div2 text</div>
最佳答案
将您的 css 文件分开,并仅链接到包含您需要的 css 的 css 文件。
关于html - 是否可以在 html 中加载外部 css "specific some lines"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46806589/