【发布时间】:2020-02-12 14:40:42
【问题描述】:
我正在尝试为 div 应用特定的样式表,我不想为此使用 iframe,我试过这个:
<div id="superdiv">
<style>
#superdiv {
@import url("./css/style.css");
}
</style>
//html that apply css here from stylesheet linked before
<h1 class="x"> Hello</h1>
</div>
【问题讨论】:
-
“div 的特定样式表”是什么意思?你想对那个 div 应用一个特定的样式吗?样式表是 document 的所有 CSS 规则,而不是 div。
-
在 html 中使用 scoped 属性,w3schools.com/tags/att_scoped.asp