Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Multiple sheets referencing the same CSS
Old 12-11-2009, 07:00 PM Multiple sheets referencing the same CSS
pityocamptes's Avatar
Experienced Talker

Posts: 48
Trades: 0
If, I am going to be pretty much using the same exact setup for each page, do I use classes or just #whatever in my CSS? Each page only has a certain tag named once, so I am thinking #whatever should be fine, and no need for classes since I do not reference the style attributes more than once... thoughts? Thanks!
__________________
"Skin in behalf of skin. A man will give up everything he owns in exchange for his life. But stretch out Your hand and strike his flesh and bones, and he will surely curse You to Your face."

Last edited by pityocamptes; 12-11-2009 at 07:21 PM..
pityocamptes is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-11-2009, 07:56 PM Re: Multiple sheets referencing the same CSS
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
I can see where your confusion is coming in, but the key thing to consider is not how often you use something, but the nature of the thing itself.

Let's say, for example, that your page is broken up into sections like this (and you're using only divs to define your page structure [otherwise some of the classes below could be replaced with tags]):

i) header
ii) top navigation
iii) left column
iv) center column
v) right column
v) footer

All of those things only occur on a page once and at no point in the future will we consider more than 1 of any of them (e.g. never 2 left columns, 2 footers, etc.). In this case, those things uniquely identify a specific thing, so it's proper to use the CSS id selector, "#".

Now, if the left column and the right column have similar styles, we can give them a class, "column" for example, that will contain the shared attribute settings to reduce the overall file size, but more importantly, to make changing both columns a 1-step process. The CSS class selector is ".". We use a class because more than one thing shares a similar style.

There is an art to this. If you get down to the level where you're creating a class for every attribute, then you've lost focus. If you start assigning classes to groups of characteristics and then need to start customizing many of them, you're not gaining anything from the use of the class and therefore wasting space.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Reply     « Reply to Multiple sheets referencing the same CSS
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13861 seconds with 12 queries