<?xml version="1.0" encoding="utf-8"?>

Curly braces in CSS

Curly braces in CSS Bad Practice
Curly braces in CSS Best Practice

All languages have rules — not because people love rules, but because that's what makes communication possible. For example, the two written phrases "let's eat, grandma!" and "let's eat grandma!" carry very different meanings. While listeners can parse the meaning from the context, browsers can't (not just yet, at least).

So what happens if you use the wrong brackets or forget to use any brackets at all? Nothing — literally. The browser won't see that your code is a declaration and won't apply style to the elements. Make sure curly braces are always there, hugging the declaration from both sides.

Improve your UX & Product skills with interactive courses that actually work