我应该使用多个CSS表吗? [英] Should I use more than one CSS sheet?

查看:89
本文介绍了我应该使用多个CSS表吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在更新网站以添加一些适合移动设备的网页。

I am updating a website to add some mobile friendly pages.

目前我们有一个大的css页面,一切都在。我的想法是把所有移动特定的CSS到一个单独的文件,然后链接这两个表。移动css会覆盖默认css中的任何内容(更大的按钮等)。

At the moment we have one big css page with everything in. My idea is to put all the mobile specific css into a separate file and then link both sheets. The mobile css will overide anything in the default css (bigger buttons etc).

我对css非常陌生,最好的做法是什么?

Im quite new to css, what is the best practice?

推荐答案

是的,你应该使用多个css文件,而不是使用一个大文件。
它可以帮助你,同时保持你的网站也使用不同的定义(classe或id名称)在不同的CSS,否则它将采取一个后面宣布的。
例如

yes you should use more than one css file rather using one big file. It helps you while maintaining your site also use different definitions (classe or id names) in different css otherwise it will take the one which declared later. For example

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
   <html>
     <head>
        <link href="/stylesheets/stylesheet.css" media="screen" rel="stylesheet" type="text/css" />
        <link href="/stylesheets/lightbox_new.css" media="screen" rel="stylesheet" type="text/css" />
        <link href="/stylesheets/another_css.css" media="screen" rel="stylesheet" type="text/css" />
      </head>

      <body>
         <!-- Your content here -->
      </body>
  </html>

这篇关于我应该使用多个CSS表吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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