I tend to take simple things and make them complicated. Will someone confirm that this is correct? I know this is very simple, but I just need someone to confirm before I go crazy! If I do this: .classname { font-weight: bold; } Code (markup): Then in my html document do this: <div class="classname"> This is text. This is text with a <a href="http://www.link.com">link</a>. </div> HTML: The text and the link will be bold right? Because I'm telling it to make all font in the div named "classname" bold. The reason I'm obsessing over such a simple concept is I got to thinking, what if you're supposed to use a separate rule for the link? I don't think you have to. Correct? By the way, the above works and makes everything in that div bold including the link in Chrome, Firefox and Safari. So, it seems to work just fine. So why am I asking? Again, I just over think things sometimes and need validation.
Okay, it's been almost an hour and no responses, I think my question is so simple, that people don't want to bother answering. I'm pretty sure I'm right though. Because if I used the <b> tag instead of CSS, I would put the <b> tag before and after my text and link. That would make the text and link bold, not just the text. So I don't see why my example above wouldn't work. So, you don't have to use a separate CSS rule for the link, the link inherits whatever font weight is set for that area. I still would like someone to respond and confirm.
Your original post is correct. Also, use <strong> instead of <b>. <div id="foo">Hello <a href="#">World</a></div> div#foo { font-weight: bold; } div#foo a { font-weight: normal; } Code (markup): In this case, <a> will not inherit its parent.
Awesome, thank you!! That's what I thought. The link will inherit the font-weight of bold, unless you specifically state otherwise.
Yes you can do for a separate rule for the link :- .classname a{ font-weight: bold; color:#111; } color is optional