Is it possible to have multiple css files for a si

2020-05-05 02:53发布

I want to be able to use several style sheets so that I can style different parts of a page. Is this possible? If so, is it as simple as adding links to the style sheets or is it more complex than that?

标签: html css
2条回答
Ridiculous、
2楼-- · 2020-05-05 03:39

Yes it is possible, just link to each style sheet in the head element.

<head>
  <link href="myStylesheet.css" rel="stylesheet" type="text/css"/>
  <link href="myOtherStylesheet.css" rel="stylesheet" type="text/css"/>
</head>
查看更多
欢心
3楼-- · 2020-05-05 03:45

Yes, it is possible and also as simple as you pointed it out, just by simply adding each style into your html file. But keep in mind, using more style sheets is not the best way in order to keep up a good performance.

While rendering your html, your browser is only able of downloading 2 parallel files at a time. So using more than 1 css file would have negative effects on your performance. To avoid that I would recommend using more css files during development and using some tools like Grunt or Gulp to put all of your different css files together into 1 file.

查看更多
登录 后发表回答