I can't figure out how to properly do this. I have the following CSS:
#container > #main > #content > a {
color: #3B7315;
}
I'm using that to supposedly style all <a>
tags in the #content
div. The problem is, however, it doesn't seem to style <a>
tags inside divs or nested lists, etc. It only styles the top-most tags such as the following:
<div id="content">
<a href="#">Lorem ipsum</a>
</div>
When I put the link inside another element, the styling is gone.
So how do I include the whole sub elements and make the style recursively apply itself from #content
onwards? I think I'm looking for a wildcard value of sort?
The <div> tag can NOT be inside <p> tag, because the paragraph will be broken at the point, where the <div> tag is entered. To apply styles inside a paragraph use <span> tag, which is used with inline elements.
CSS Code. When styling the text of the link itself, we simply reference the anchor tag class name only, and we change change things such as the text's color and other attributes. When referencing the special attributes of the anchor tag, such as link, visited, hover, and active.
You have to give your anchor a the rule display: block; . Anchors are inline elements per default. If you give an element position: absolute , you take it out of so-called normal document flow.
You made it much more complicated than it needs to be:
#content a {}
#content a, #content a:link, #content a:visited {base style rules}
#content a:hover, #content a:visited:hover, #content a:active {over style rules}
#content a:focus {wai style rules}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With