Topic: CSS...sharing IDs..?? |
|
---|---|
Author | Thread |
Paranoid (IV) Inmate From: |
posted 07-06-2009 23:18
In the current theme for my Wordpress blog the main template refers to a div called content. In the main style sheet, the content is defined as below. code: #content { text-align:left; font-size:12px; font-family:Geneva, Arial, Helvetica, sans-serif; padding:12px 80px; color:#EDE6EE; background-color:#303030; float: left; width: 628px; } #content a { color:#FFEBCD; text-decoration: none; outline: none; } #content a:hover { color:#EDE6EE; }
code: #content { background-color:#303030; } #content2 { background-color:#000000; } #content content2{ text-align:left; font-size:12px; font-family:Geneva, Arial, Helvetica, sans-serif; padding:12px 80px; color:#EDE6EE; float: left; width: 628px; } #content content2 a { color:#FFEBCD; text-decoration: none; outline: none; } #content content2 a:hover { color:#EDE6EE; }
|
Lunatic (VI) Inmate From: under the bed |
posted 07-06-2009 23:33
No. The CSS would have no way to know that you want to relate it to the #content styles. code: #content, #content2 { ...shared styles.... }
code: #content a, #content2 a { ...shared styles.... }
code: #content, div p span strong a, .thisclass, li.thatclass, .thisclass .thatclass, #thisid .thisclass (etc etc etc){ ...shared styles.... }
|
Paranoid (IV) Inmate From: |
posted 07-06-2009 23:56
Ok thanks DL. code: .bgcontent0 { background-color:#303030; }
code: <div id="content" class="bgcontent0">
|
Lunatic (VI) Inmate From: under the bed |
posted 07-07-2009 04:53
Of course, ideally you would also have a class name that was semantically relevant - one that gave an indication of the purpose of the element (or the purpose of the differentiation in class), that would remain relevant should the particular style attribute you are addressing at the moment was no longer the issue...a hint at the subject matter contained within perhaps...? |
Paranoid (IV) Inmate From: |
posted 07-07-2009 06:17
Agreed, but then I would have to be sane right? |
Lunatic (VI) Inmate From: under the bed |
posted 07-07-2009 06:23
I am not aware of anything that has sanity as a prerequisite. |
Paranoid (IV) Inmate From: |
posted 07-07-2009 21:52
Missed your edit first time around. |
Obsessive-Compulsive (I) Inmate From: San Antonio, TX |
posted 08-09-2010 18:07
One of the biggest things I've learned is knowing when to use ID= vs. class=. |