CSS Syntax

CSS syntax includes a selector, a property, and its value. The selector points to an HTML element where the CSS style is applied. The CSS property and value are connected by semicolons. This involves matching the selector name with its associated property-value definition.


selector { Property: value; }


Let’s clarify each of these terms:

  • Declaration: This is made up of a property and the value it should have.
  • Selector: It pinpoints which HTML elements to style.
  • Property: It determines the exact feature of an element you’re changing.
  • Value: It’s the assigned setting for a property, deciding how the element should look or act.

Also read, Why should you Study JavaScript?


In this example, we’ll take it step by step, using clear and easy explanations.

<!DOCTYPE html>
<!-- Style on h1 elements -->
h1 {
color: red;
text-align: center;

<h1>Easy Coding School</h1>


  •  h1 is the selector of h1 tags.
  •  it selects the h1 element
  • The color is a property and red is the value of that property, a similar text-align is the property, and the value of that property is the center.

Leave a Reply

Your email address will not be published. Required fields are marked *