Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

CSS External Style Sheets

Featured Replies

Hey guys :hi:

 

I need your opinion. I've been checking out people's style sheets, like yours Eggman, to see how they do different things (though I don't steal like other people that we've complained about). I've noticed that many of you have just one style sheet for both your formatting and your layout. Why is that? I've been of practice to make separate style sheets for format and layout. Now is that counter productive? Does that have a bad influence on the browser's load time. Or is it just personal preference.

 

Let me know what you think 8)

mmm, I have never really thought about separating format and layout into different style sheets although that could prove relieving for the painful times I've had going back through my CSS and trying to work out what does what!

 

By seperating format and layout do you mean having one style sheet for changing things like font, font style, font size etc? and another for position and floats etc?

 

My style sheets always start off neat and concise but as I get more and more into the development I end up just latching arbitrary bits of code onto the end of the document

  • Author

Yea I have the font stuff and things not needed for layout in the format area and the layout stuff in the layout area. I like it much better that way I just want to make sure I'm not hurting myself by doing that.

 

8)

If you can get it all in one file and keep the filesize down so that the whole CSS file fits in 1 packet then you should just use 1 file.

 

Performance wise I am sure it will be better if 1 file is sent rather than 2-5 files.

Yea I have the font stuff and things not needed for layout in the format area and the layout stuff in the layout area. I like it much better that way I just want to make sure I'm not hurting myself by doing that.

 

8)

 

No reason not to do this.

 

Only problem I can think of is if you want to for example specify different atrtributes for a <p> or an <h> or a <li> in a particular <div> as opposed to the global one defined in your formatting stylesheet. Where does this then go?

 

Eg

 

Global

 

h1 { font-size : 1.4em; }

 

goes in format sheet

 

But in class called say myClass you want

 

.myClass h1 { font-size : 1.2em; }

 

Guess you could solve by simply still considering it formatting and adding to the format stylesheet but may get confusing?

 

:flm7:

For most sites a single stylesheet is more than adequate, mainly because it cust down on calls to just one file. If however you are running an extremely large and complex site then it often makes sense to have multiple sheets to separate out global from "local" styles, and to keep the overall download size smaller.

  • 2 weeks later...

@EggMan: yeah.. i've read that article long time ago, and that is my favorite design blog

Personally I always use at least 3. I call a global which imports a reset and the layout.

This is something I've been puzzling about. And reading the above reckon splitting them is the way to go. The server-hit is minimal and in the long run probably easier to edit and manage and far more scalable.

Why would you use three stylesheets if you could just use one? It'd make it easier to find things if you didn't have to remember which file they were in... wouldn't it?

I normally just section mine off in one stylesheet. Something like:

 

Body

Headings

Header

Navigation

Content

Footer

 

Obviously depending on the look of the site depends on what the sections are but you get the idea :pp

 

I sometimes will have a separate print stylesheet, and other times I might need to change a couple of things to make it IE6 or below compliant (but this is quite rare for me)

I normally just section mine off in one stylesheet. Something like:

 

Body

Headings

Header

Navigation

Content

Footer

 

This is how I do it at the moment but often find myself scrolling up and down the screen when editing. Figure I'll try splitting the CSS up on my current project and see how it compares. I'm doing a full overhaul of our site from ASP to PHP/MySQL so figure might aswell overhaul the CSS whilst I'm at it B)

It can be a task looking through 5000 lines of CSS so I generally separate both my pages and CSS into:

 

- main.css

- forms.css

- navigations.css

- text.css

- print.css

 

etc etc, it goes on! I'm used to working with ridiculous amounts of files and find it more organised. Once you get yourself a pattern and know where you've put things (and where you naturally will) it's extremely easy and efficient to get right to what your looking for.

  • Author

wow but so no one just separtes the layout from the format then huh? 8)

I do.

 

Unless it's a very small project I use 3:

reset.css

layout.css

style.css

 

Reset is eric meyer's reset. Layout has all the structure, width, margin and padding stuff. Style has colours, font sizes, images etc.

 

I've not been working like that for long, so am still deciding what goes where exactly, but I do find it easier to manage.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.