Designers want to add external CSS files, but they only may work on modules/templates, now what?
So coders created actions, now designers can build HTML to display... but they dont edit whole layout, only the templates (body element itself). How to solve if they want to use external CSS files? And lets suppose theres a layout (header+link) and site can have two templates: a, it didnt need CSS, 开发者_JAVA技巧b, it needs 2 CSS file, and maybe a JS too.
a "simple" way to work like that is to create a single css for each page and a general css file for the whole website.
The general css file (let's call it base.css) has the basic structure (headers, fonts, general colors, etc).. and the other css files have the style related to the corresponding page (i.e. home.css , contact.css, login.css , etc)
If you work on mvc.. the controller should load the corresponding css file according to the request (create the <link type="text/css" src="..">
), and in all the cases, you'd have to load the base.css first
So now the browser has to load 2 css files... and ideally, you shouldn't have unused css code
Hope this helps
精彩评论