🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to CSS Notes
Topic #3

CSS Syntax


CSS Syntax

A CSS rule consists of a selector and a declaration block:

The selector points to the HTML element you want to style.

The declaration block contains one or more declarations separated by semicolons.

Each declaration includes a CSS property name and a value, separated by a colon.

Multiple CSS declarations are separated with semicolons, and declaration blocks are surrounded by curly braces.

Example

p
{

  color: red;

  text-align: center;

}

Example Explained

  • p is a selector in CSS (it points to the HTML element you want to style:

    ).

  • color is a property, and red is the property value
  • text-align is a property, and center is the property value

Note: You will learn much more about CSS selectors and CSS properties in the next chapters!

Want to go beyond the notes?

Join CodingNow 2.0's CSS course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

CSS Syntax – FAQs

Quick answers about learning CSS Syntax in CSS.

This free note from CodingNow 2.0 explains CSS Syntax in CSS — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every CSS topic on CodingNow 2.0, including CSS Syntax, is 100% free with no signup required.
With focused practice, most students grasp CSS Syntax in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now