使不同的样式表适用于页面的不同区域 [英] making different syle sheets apply to different areas of the page

查看:42
本文介绍了使不同的样式表适用于页面的不同区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有各种 css 基本上我想确定页面的每个部分使用什么样式表,例如我希望我的导航栏使用导航样式表,而页面的其余部分可以使用主样式表.有什么想法吗?

I have various css's basically I want to determine what stylesheet each section of the page uses, for example I want my navigation bar to use the navigation stylesheet where the rest of the page can use the main stylesheet. Any ideas?

推荐答案

您不能这样做.样式表适用于整个页面.您必须简单地使选择器足够具体,以便样式仅应用于预期元素.

You cannot do this. A stylesheet applies to the entire page. You must simply make your selectors specific enough so that styles are applied only to the intended elements.

在您的示例中,您可以将导航项放在

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆