多个“HTML"HTML 文件中的标签:当类和 id 可以相同时如何分离 CSS 规则? [英] multiple "HTML" tags in HTML file: how to separate CSS rules when classes and id's can be the same?
问题描述
我看到浏览器正确呈现了多个 HTML 标记文件.我的意思是两个 html 文件合并和连接.但是,如果我将 STYLE 区域放入每个 HTML 部分并且类或 id 相同,我会将最后的 css 规则也应用于第一部分.我问如何让css规则只作用于它们插入的部分,即使类和id是相同的.我需要这个特殊的东西,所以我正在寻找解决方案或技巧.
I see that multiple HTML tag file is correctly rendered by the browser. I mean like two html files merged and concatenated. But if I put a STYLE region into each of the HTML parts and the classes or id's are the same I get the last css rules applied also to the first part. I ask how to make css rules acting just on the part they are inserted, even the classes and ids are the same. I need this special thing, so I am looking for a solution or a trick.
推荐答案
我认为一个文档中不允许使用多个 html-Tag.我看不出这样做有什么好处.
I think multiple html-Tags in one document are not allowed. I do not see any advantages for doing so.
当你有多个文档时,考虑使用frame或者更好的iframe-tag
When you have multiple documents, consider to use the frame or better iframe-tag
这篇关于多个“HTML"HTML 文件中的标签:当类和 id 可以相同时如何分离 CSS 规则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!