Master AI & Build your First Coding Portfolio with SkillReactor | Sign Up Now

Lesson 5 - Overview Of CSS

5.3 CSS Syntax

CSS syntax comprises selectors and declarations, which work together to style HTML elements effectively.

  • Selector: Specifies the HTML element that will be styled.
  • Declaration: Contains a property and a corresponding value, defining the style to be applied to the selected element.


p {
    color: blue;
    font-size: 14px;

In the example above:

  • p is a selector targeting all <p> (paragraph) elements on the webpage.
  • Inside the curly braces {}, color: blue; sets the text color of paragraphs to blue, and font-size: 14px; adjusts the font size to 14 pixels.

Understanding selectors and declarations is fundamental to effectively styling webpages with CSS. We'll delve deeper into these concepts in our upcoming lesson.