SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
-
Oct 29, 2007, 23:56 #1
- Join Date
- Mar 2007
- Posts
- 81
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
css question - re styling the bold tag
ok...lets say one of the cells in my html table has the class: cell4
and the css definition is:
.cell4 {
background: #FFFFFF;
padding: 5px;
font: 11px Arial, Helvetica, sans-serif;
}
Lets say I want all of the <b> tags in this cell to be navy blue, 12 pt...
How can I set the b tag to only affect this cell?
If I use:
b {
font: bold 12px Arial, Helvetica, sans-serif;
color: #000066;
}
It works, but all of the bold tags in the other cells on the web page turn blue too
any ideas?
-
Oct 30, 2007, 00:01 #2
- Join Date
- May 2007
- Location
- Newcastle, Australia
- Posts
- 3,718
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
.cell4 b {
font: bold 12px Arial, Helvetica, sans-serif;
color: #000066;
}
-
Oct 30, 2007, 00:56 #3
- Join Date
- Jun 2007
- Location
- San Diego, CA
- Posts
- 784
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
though I would consider using an alternative to the bold tags. Ideally, try to avoid using tags/classes that imply appearance. CSS lets you so easily redefine appearance and position that names which identify those properties now, become incredibly poorly named later on when you change them. A class, leftColumn, seems like a good name until your client changes their mind and wants it on the right. Use classes like subHeading, mainMenu, footnote, songTitle, etc. Say what it is and your CSS will never confuse the issue, no matter how you choose to present it. This also makes your code much more portable so you can reuse it more easily for other clients and other websites.
Whatever you can do or dream you can, begin it.
Boldness has genius, power and magic in it. Begin it now.
Chroniclemaster1, Founder of Earth Chronicle
A Growing History of our Planet, by our Planet, for our Planet.
-
Oct 30, 2007, 03:50 #4
- Join Date
- May 2006
- Location
- Aurora, Illinois
- Posts
- 15,476
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I'd also use a far more meaningful class name than "cell4" - what is that anyway, a prison that stylesheet is styling, or a Web page?
Save the Internet - Use Opera | May my mother rest in peace: 1943-2009
Dan Schulz - Design Team Advisor | Follow me on Twitter
SitePoint References: HTML CSS JavaScript | Become A Guru
WordPress SEO Checklist | What WordPress Plugins Do You Use?
Web Standards Curriculum | Image Free Equal Height Columns
Bookmarks