Published on

Learning CSS

Table of Contents

https://www.w3schools.com/Css/css_syntax.asp

Syntax

  • Declarations include a property name, and a value, separated by a colon

  • Multiple declarations are in a block surrounded by curly braces

Selectors

Element Selectors

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

Selects all elements on the page of the specified type

id Selector

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

Selects the id attribute of an HTML element

class Selector

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

Selects all HTML elements with a specific class attribute

Other Selectors

* -> Universal selector

  • Can group selectors