December 17, 2018 · coding CSS

The Anatomy of CSS Syntax

The word "Syntax" refers to the grammer of the CSS language.

The first section you will see is the selector (who), inside the curly brackets are where the rules sit -property (what) and value(how). Every line needs to end with a ;

222-1

A best practice rule for CSS structure is after the selector there needs to be a {, the first property and value will be on the following line, if there is more than one change to a single selector then it will continue onto the next line - also the selectors should be in alphabetical order. Remeber, each line needs to end with a ;. Once you have finised the code will end with the closing }

For example

h1 {
    color: red; 
    font-size: 200px;
}
  • LinkedIn
  • Tumblr
  • Reddit
  • Google+
  • Pinterest
  • Pocket