Css basics + css selector (element selector and link selector)
First, I will introduce how to import css styles in html webpages.
1. Intra-row style:
Use css for intra-row styles
2. In-page style: Set in the head label
Use css styles on the page
3. External link mode: First, you must prepare a css style sheet externally.
Set the style of the external link css style sheet. Note that heaf = "Here is the address of the css style sheet to be imported"
Next, I will introduce css cascade styles.
Element selector: class selector, id selector, class selector, and wildcard Selector
Type selector: select an element class label.
Id selector:
Class selector:
Wildcard character selection:
The type selected by the wildcard is abstract, so use it with caution!
Next, we will introduce the relationship selector, including the selector, subselector, adjacent selector, and sibling selector.
Contains the selector:
ul li{color:red;}All the li labels below ul labels are set with styles
Sub-selector:
Ol sublevel elements are selected
Adjacent selector:
Select the sibling level li element next to the li tag
Sibling selector:
Select All sibling elements behind the li tag
The above is what I want to introduce.
In addition, I would like to add a few points:
First line indent: text-indent: 4em;
Center display: teext-align: center;
Priority:
In-row css> On-page css> external css
# Id>. class
If the style set later already exists, the style set later will be overwritten.
For example:
Specifically, it must overwrite the abstract
For example, if you use the set wildcard to select a matching element selector, the part that uses the element selector will not be overwritten by the wildcard selector.