CSS syntax
selector{
Property:value
}
Example: h1{color:red; font-size:14px}
property is greater than 1, the attributes are separated by a semicolon
If the value is greater than 1 words, you need to enclose a quotation mark
p{font-family: "Sans serif";}
Selector grouping:
h1,h2,h3,h4,h5,h6{color:red;}
Inherited:
body{
Color:green;
}
css-Derived selectors
Define a style by the context in which the element is located
Css-id Selector
The ID selector can specify a specific style for an HTML element labeled with an ID
The ID selector is defined as "#"
The ID selector is often used to create a derived selector
css-class Selector
Class selector displays at one point
Class can also be used as a derived selector
css-Property Selector
Styling an HTML element with a specified property
Properties and Value selectors
body{ color:red;} H1,h2,p{ color: bisque;} /* derivation selector */li strong{ color: black;} Strong{ color: blue;} /*id Selector */#divId { color: brown;} The/*id selector and the derived selector work together */#pid a{ color: crimson;} /* class selector */.pclass{ color: chartreuse;} /* Class selector derived selectors work together */.divclass a{ font-size: 100px; color: black;} /* Property selector */[title]{ color: chartreuse; font-size: 50px;} /* Property and Value selector */[title=te]{ color: chocolate; font-size: 10px;}
<! Doctype html>
CSS base syntax and selector usage