Forum Moderators: not2easy

Message Too Old, No Replies

Site Redesign in CSS - Have a Few Questions.

.css file or style

         

wfernley

1:35 pm on Mar 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey everyone,

I'm going to be reworking the code of my site by cleaning it up and making it W3C compliant.

I figured I would redesign the site in CSS considering this would clean up the code more. I do have a few questions considering I have never really done a complete site in CSS. I'm sure I will still need tables here and there but I most of it will be CSS.

Should I put all the CSS information in a CSS file or just in the style="". I'm assuming that for site wide styles, I should use a CSS file but for page specific, I should use style="".

My site is very large and has many pages. Most of the site is fairly dynamic so doing some code updates shouldn't be a massive job.

Any help or suggestions would be greatly appreciated :)

Thanks!

dwighty

4:51 pm on Mar 6, 2007 (gmt 0)

10+ Year Member



Hi wfernley,

Personally I would put all of the styling into a .css file

You could then spilt the css into different files for example a layout.css and then have a specfic css file for a page/function such as a shop/forum, shopstyle.css for example.

Having your style stripped from the main pages and placed into 1,2,3 css files will make your life so much easier if/when you make any changes/amendments in the future.

Fotiman

5:16 pm on Mar 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I agree with dwigthy. One main stylesheet, and then individual stylesheets as needed, each in their own file. By putting them in their own file, the styles will be cached by the browser for subsequent visits to the page. If you put them into <style></style> tags instead, visitors will be downloading all of that information every time they visit the page.

wfernley

6:09 pm on Mar 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yeah that does make sense.
So you can easily call more than one CSS file?

Fotiman

6:25 pm on Mar 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yeah, in your head you would just link them in like this:


<head>
<link rel="stylesheet" type="text/css" href="mainlayout.css">
<link rel="stylesheet" type="text/css" href="thispage.css">
<title>This Page</title>
</head>

In other words, first you include the stylesheet that has your main layout rules, then you include any other stylesheets.

wfernley

6:39 pm on Mar 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That does make sense. I will keep that in mind :)

Thanks again for the suggestion :)