If <class> <tag> selects any <tag> inside of a class, what does <tag>.<class> do?

If <class> <tag> selects any <tag> inside of a class, what does <tag>.<class> do?

selects all elements with that class. So lets say you have:

<span class="example">some text</span>
<div class="example">some text</div>

then div.example will target only the div, not the span

1 Like

Aside

We should note that there is a difference between a TAG and an ATTRIBUTE. Attributes are not tags, but properties of a tagged object.

tag = {
    class:
    id:
    title: 
    ...
}

This is how we can think of it when viewing,

<p id="one" class="some" title="key sentence">This is the key sentence.</p>

P is the element node; <p> is the OPENTAG; </p> is the ENDTAG; id, class and title are the element attributes.