On 1/25/07, Michael Turnwall <[EMAIL PROTECTED]> wrote:

I have a co-worker, that whenever he creates a class, puts "div" in front of
it if the class is being assigned to a div. Here's an example:

div.container {
 background-color: #fff;
 margin-bottom: 18px;
}

div.container div.container_inner {
 border: 1px solid #bbb;
 margin-left: 8px;
}

div.container div.inset {
 padding: 3px;
}

As you can see, the code can get messy rather quickly. He says he does it to
avoid conflicts. My argument is that you should only do that when you
specifically want the class only to apply to a div. If I want to use the
class on another element I can't without creating a new rule. I would think
the better way would be to create the class without the "div." part first
and in the future add the "div." part if I need to be more specific. This
allows the CSS to be more generic and cleaner.

I think you have the right idea... the above code is not very good.
The fact that he's making rules which you can't reuse just because he
insists on adding div. is a problem. I think the way to do this is to
start with a generic .container, and then if there is something that
should be specific to divs add a div.container rule... but working
without a .container rule at all is pointless.

--
--
Christian Montoya
christianmontoya.net .. designtocss.com


*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************

Reply via email to