【发布时间】:2013-09-13 05:09:07
【问题描述】:
是否可以为文档中的 div 设置单独的 CSS 文件。此DIV 不应继承页面中包含的其他CSS 文件的任何属性。我将尝试通过以下几行使其更清楚。我期待这样的事情。
<html xmlns = "http://www.w3.org/1999/xhtml" xml:lang = "en" lang = "en">
<head>
<link rel = "stylesheet" type = "text/css" href = "main_style.css" />
</head>
<body>
<div class="main">
<div rel = "stylesheet" href = "sub_style.css"> <!-- This with seperate stylesheet.-->
<!--
Elements here will have style only from sub_style.css and not from main_style.css
-->
</div>
</div>
</body>
</html>
编辑:如果使用 DIV 无法实现,我们可以使用 iframe 来实现吗?
【问题讨论】:
-
创建您自己的类,它在
main_style.css中没有被引用,并在sub_style.css中对其进行样式设置。在此之前您可能想要对其进行规范化。