How role have a space in css?


How role have a space in CSS?

What role has this space?
This is in an elections article:

li h4 {
color: gold;

Hi @eduard2012. Hmm, not sure if I fully understand your question. But here is what I think you are asking about:
CSS coding standards

1 Like

Let’s look at that in conventional form:

li h4 {
  color: gold;

In the above the only space character that has a role is the one in the selector.

li space h4

The space character denotes this as a child selector. The h4 must be a child of an li. This is an important selector that we tend to use a great deal. Consequently you’ll be well used to writing them with your desired intent in mind.

As for the other space characters, none of them have any meaning in CSS so can be removed with zero effect. Consider that line breaks are also whitespace.

li h4{color:gold;}
the only space that matters


When we consider the specificity of this selector it has two type selectors so has specificity,

0 0 0 2

What does that mean? It means that it will override or augment any selector rule for just an li, and likewise override any selector rule for just an h4.