Topic: CSS...sharing IDs..?? (Page 1 of 1) |
|
---|---|
Paranoid (IV) Inmate From: |
![]() 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 |
![]() 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: |
![]() Ok thanks DL. code: .bgcontent0 { background-color:#303030; }
code: <div id="content" class="bgcontent0">
|
Lunatic (VI) Inmate From: under the bed |
![]() 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: |
![]() Agreed, but then I would have to be sane right? |
Lunatic (VI) Inmate From: under the bed |
![]() I am not aware of anything that has sanity as a prerequisite. |
Paranoid (IV) Inmate From: |
![]() Missed your edit first time around. |
Obsessive-Compulsive (I) Inmate From: San Antonio, TX |
![]() One of the biggest things I've learned is knowing when to use ID= vs. class=. |