Oddbean new post about | logout
β–² β–Ό
 @90431d67 So if you don't mind, is it easy to explain the difference between "div .foo" and "div.foo"? 
 @957492b3 Probably not as easy, but `div .foo` matches markup like this:

<div><span class="foo"></span></div>

That span tag could be any tag because `.foo` is not prefixed with a specific tag name.

While `div.foo` matches this:

<div class="foo"></div>

BTW, `div.foo.bar` matches:

<div class="foo bar"></div>

But not divs with only foo. 
β–² β–Ό
 @90431d67 I must thank you yet again. But alas, CSS proves yet again that it eschews clear syntax for compactness.

The UX designer in me would say that div.foo is clear and so is div > .foo 

However allowing a space is needlessly compact, creates ambiguity, and hurts readability. (he says VERY naively)