Curriculum
Course: CSS
Login

Curriculum

CSS

CSS INTRODUCTION

0/1

CSS Selectors

0/1

CSS Comments

0/1

CSS Padding

0/1

CSS Box Model

0/1

CSS Combinators

0/1

CSS Pseudo-classes

0/1

CSS Pseudo-elements

0/1

CSS Dropdowns

0/1

CSS Image Gallery

0/1

CSS Image Sprites

0/1

CSS Counters

0/1

CSS Website Layout

0/1

CSS Specificity

0/1

CSS Math Functions

0/1
Text lesson

CSS Syntax

CSS Syntax

IMG_3326

The selector indicates the HTML element targeted for styling.

Within the declaration block, there are one or more declarations, each separated by semicolons.

Every declaration consists of a CSS property name and a corresponding value, separated by a colon.

Semicolons separate multiple CSS declarations, while curly braces enclose declaration blocks.

Example

In this instance, all <p> elements will be aligned to the center and have their text color set to red.

{
  color: red;
  text-align: center;
}

Example Explained

  • In CSS, ‘p‘ functions as a selector, indicating the HTML element targeted for styling, namely the <p> element.
  • color‘ represents a property, with ‘red‘ serving as its corresponding value.
  • Similarly, ‘text-align‘ stands as a property, with ‘center‘ denoting its value.
You will learn much more about CSS selectors and CSS properties in the next chapters!