CSS Lesson 1: Syntax


CSS Syntax

Welcome to the most exciting part of web-development. Before starting the CSS tutorial, it’s important for you to understand the Syntax of it. A CSS Syntax consists of a Selector and Declaration Block.


You can see from the image, The Selector is the HTML Elements which you want to style, while the declaration block contains a property and value separated by colon (:). You can add multiple declaration blocks by adding a semi-colon (;) at the end.

Don’t worry if syntax confuses you right now. You will become a black-belt master of it in next few days! Just stay connected!

CSS Comment

Just like the HTML Comments , CSS also has the comments. Its syntax starts with /* and ends with */. The comments are not visible to readers- they are just for your own convenience.

Comment Usage
Comments are very useful in handling the CSS code.

  • Use comments at start and end of each section i.e. header, navigation bar, footer etc.
  • Best to use for in cross-browser/devices codes.

Next Lesson

Let’s move to the most integral and interesting part of CSS which is: Selector. In the next lesson you will learn what selectors are and how to use them in CSS.

Leave a Reply