The structure (syntax) of CSS commands

Building a CSS statement is actually very simple. Important in the first step is understanding the structure of the CSS statements (In the language of computer freaks: syntax).

CSS statement simply described in plain English:

What should have for what property a certain value


The “what” term in computer slang is “selector”

Selector {Property: Value;}


Here an example to define a color for h2 tags:

h2 { color: red; }


Curly braces in CSS

The curly braces {} include the combination property and value. The braces are important because it is possible (and very common in practice), to give different properties to an element:

Selector {Property1: value1; Property 2: value2; Property3: value3; }

Colon and semicolon

Between the property and the Value you must insert a colon and after the Value a semicolon. If you forget one of these signs you CSS styling will not work!



Join the Discussion
Write something…
Recent messages
arick Premium
Thank you!
Reply
Karyskis Premium
Great training, thank you!
Reply
KatieMac Premium
very good bit of training thank you
Reply
KD6PAO Premium
Very well done Giludi and easy to understand! Much appreciated!
Joe
Reply
masirois Premium
Great training! It proves I have been right about some of my "best guess" assumptions when try to decipher CSS and HTML :) This really helps to clarify a lot. Thanks!
Reply
Top