I am having a rather difficult time understanding this type of css selector show below, or at least how to apply.
p .intro a { color: yellow }
Custom HTML tags are completely valid markup, they are supported by all browsers and should be considered best practice. If you can benefit from the many features of custom elements and there aren't any existing HTML tags that are a better fit for your purpose, then it's recommended to use them. Are Custom Tags Better Than Divs?
A simple Google check will verify if a tag is standard or custom. Using custom tags with or without javascript makes the document more readable. Which is the point you were making. Not everything needs to be predefined. If it were the language would never have evolved in the first place.
The formatting tags are divided into two groups: physical tags, that are used to style the text (visual appearance of the text) and logical or semantic tags that add semantic value to the text parts (e. g., inform search engines for which keywords a web page should be ranked). Let’s dive deeper and talk about formatting tags in details.
The <em> tag defines emphasized text, with added semantic importance. <!DOCTYPE html> <html> <body> <p> This is a paragraph </p> <p> The important part of the text is defined <em> in italic </em>. </p> <p><i> Lorem ipsum </i>, or lipsum as it is sometimes known, is dummy text used in laying out print, graphic or web designs. </p> </body> </html>
p .intro a { color: yellow }
It would style any (reading from right to left)
a
tagintro
p
tagExample (note that the elements are not direct children, but descendants):
<p>
<span>
<span class="intro">
<span>
<a href="#">I am yellow</a>
</span>
</span>
</span>
</p>
(fiddle)
This selector would match HTML similar to this:
<p>
<span class="intro">
<a href="#">I am yellow</a>
</span>
</p>
Basically, a a
tag inside of a tag with a class of intro
inside of a p
tag. They don't have to be direct children.
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