简体   繁体   English

CSS使用多个样式表问题

[英]Css using multiple stylesheets issue

In simple html page,we can use something like this: 在简单的html页面中,我们可以使用如下代码:

<style type="text/css">
a {text-decoration:none;}
 a { color: inherit; } 
/*----------Text Styles----------*/
.ws72 {font-size: 88px;}
.ws74 {font-size: 93px;}

.wpmd {font-size: 13px;font-family: Arial,Helvetica,Sans-Serif;font-style: normal;font-weight: normal;}
/*----------Para Styles----------*/
DIV,UL,OL /* Left */
{
 margin-top: 0px;
 margin-bottom: 0px;
}
</style> 

With classess like: 使用以下类:

<div>
 <font class="ws72" >
      </div>

And another one like: 另一个像:

<div class="wpmd">
      <div>

That's all with same page css and now how can i use something like: 所有这些都使用相同的页面CSS,现在我该如何使用类似的东西:

<link href="example.com/better.css" rel="stylesheet" type="text/css">  for class .ws72 

and like: 像:

<link href="example.com/best.css" rel="stylesheet" type="text/css">
for .wpmd

First of all you're using old html tag like <font> which is deprecated to use nowadays. 首先,您正在使用像<font>这样的旧html标签,如今已不建议使用它。 So, I recommend you not to use that tag. 因此,我建议您不要使用该标签。

And to your question you don't need to separate the stylesheets but you can add multiple style rules in your single stylesheet and if the page has one class then your stylesheet will use that and same thing applies for other pages. 对于您的问题,您无需分隔样式表,但是可以在单个样式表中添加多个样式规则,如果页面具有一个类,则样式表将使用该样式规则,而其他页面也可以使用相同的样式。

You can use all types at the same time. 您可以同时使用所有类型。 Just remember that it will execute with different priority according to css selectors weigth. 只需记住,它将根据CSS选择器weigth的优先级执行不同的操作。 Read about it at MDN , or at Smashingmagazine (with cool pictures). MDNSmashingmagazine (带有精美图片)上阅读有关它的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM