1. New features of HTML5
The new features of HTML5 are mainly aimed at the previous deficiencies, adding some new tags , new forms and new form attributes , etc.
1. New semantic tags in HTML5
- header: head label
- nav: navigation label
- article: content tag
- section: defines an area of the document
- aside: sidebar label
- footer: footer label
2. Added multimedia tab
2.1 Common Attributes of Video
Attributes |
describe |
autoplay |
Video ready to autoplay |
controls |
Display playback controls to the user |
width |
Set player width |
height |
Set player height |
loop |
Whether to continue playing the video after playing, loop |
preload |
Specifies whether to preload the video |
src |
Video Url address |
poster |
Loading waiting screen picture |
muted |
Mute playback |
2.21 Common attributes of audio
Attributes |
describe |
autoplay |
Audio ready to autoplay |
controls |
Display playback controls to the user |
loop |
Whether to continue playing the audio after playing, loop |
src |
Audio Url address |
3. Newly added input tag
4. New form attributes
Two, the new features of CSS3
- attribute selector
- Struct pseudo-class selector
- Pseudo-element selector
1. Add attribute selector
2. Add structure pseudo class selector
1. nth-child(n) selects one or more specific child elements of a parent element
- n can be numbers, keywords and formulas
- If n is a number, it is to select the nth child element, and the number inside starts from 1
- n is a keyword: even even, odd odd
official |
value |
2n |
even |
2n+1 |
odd number |
5n |
5 10 15 |
n+5 |
From the 5th (including the fifth) to the end |
-n+5 |
The first 5 (including the 5th) |
the difference:
- nth-child sorts and selects all children in the parent element (the sequence number is fixed) first find the Nth child, and then see if it matches E
- nth-of-type sorts and selects the specified child elements in the parent element, first matches E, and then finds the Nth child according to E
3. Add pseudo-element selector
selector |
Introduction |
::before |
Insert content before inside the element |
::after |
Insert content after the inside of the element |
Notice:
- before and after create an element, but are inline elements
- This newly created element cannot be found in the document tree, so we call it a pseudo-element
- Syntax: element::before{}
- before and after must have a content attribute
- before creates an element before the content of the parent element, and after inserts the element after the content of the parent element
- Pseudo-element selectors are the same as label selectors , with a weight of 1