CSS: testing whitespace in parsing

Whitespace in CSS can either be taken into account or ignored by a parser. It depends on the context where whitespace occurs. For example:


div {
    
    color: green;
    
}

p{color:gray;}

In this context, whitespace is ignored. But in another context like this:


p span {color: teal;}

whitespace is significant because it actually identifies a descendant selector.

Example

Significant and non-significant whitespace

This entry was posted in by Gabriele Romanato. Bookmark the permalink.

Leave a Reply

Note: Only a member of this blog may post a comment.