CSS uses a very simple and consistent syntax that is very easy to learn. Here is an example.

body {

In the example above, "body" is the selector. The selector can use any tag, class, or ID to select a specific HTML element, or a group of them. The three different types of selectors have their own syntax as well displayed below.

Types of SelectorsEdit

div {...css...}
.selector {...css...}
#selector {...css...}

To select a normal tag, you use no extra characters, just type the name of the element. To select a certain class, you simply type a period "." before the name of the class. For an ID, you just type a hash symbol, or "#", right before the name. These selectors are used all throughout the language, and even in some other languages, such as JavaScript.

The other parts of the syntax should be fairly apparent. You use curly brackets to open and close the statements. All of the CSS code is placed in between the curly brackets. Each individual statement must be closed with a semi colon, as shown in the example above.

Group of SelectorsEdit

If you want to target multiple selectors, you'd use commas. An example is shown below:

h1, h2, h3 {


  • In CSS, white space does not have any importance. You can add as much of it as you want, or you can not use any.
  • A semi colon is not required in the ending statement. However, it is traditionally still used.
  • The ID is used to stylize one unique element, while the Class is used to stylize multiple elements.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.