Notes organized from the classroom online teacher Liu Qiang’s video teaching course is very clear, concise courseware and attachments can be downloaded freely excellent! For beginners as well as experienced developers Web front-end Siege Lion (Spring 2021)
- There are several box models
- IE box model (border + padding + content)
- Box-sizing allows you to modify the way box models are calculated
- Block boxes and row boxes
- margin collapse:
The vertical margin will be merged with the same sign: take the difference sign with the highest absolute value: add the two
In fact, the distance between two elements is based on the one with the largest value and the two elements will overlap. The overlap is based on the one with the largest absolute value among the two values (only margin can be set to negative value in the box model attribute) The spacing between two elements is the sum of two values
- Rounded corners:
Rounded corners are rounded boxes with a perfect circle of radius X. They can be elliptical border-radius: 10px 20px 30px / 20px 10px 20px 30px; (The horizontal radius of each ellipse is 10px 20px 30px 20px; The vertical radius of the ellipse is 20px 10px 20px 30px.
- Shadow:
Doesn’t take up space
box-shadow: 10px 6px 12px 2px gray; / / level | | | | fuzzy degree vertical expansion size colorCopy the code
- Background:
background: clip|color|image|repeat|position|size
Copy the code
background-size
- The default image size is not scaled
- 100px auto;
- Allows the container to contain images (with one edge (horizontal or vertical) up to the container value)
- Cover Scale the image until the image covers the container (parts of the image may be cropped out of the container)
background-clip
- border-box;
- padding-box;
- content-box;
background-repeat
- no-repeat
- repeat(default)
- repeat-x
- repeat-y
background-position
- Set the edge
- If you set a single edge, the other direction will be centered, for example:
background-position: top; /* Top and horizontally centered */ background-position: right; /* Suck right and center vertically */ Copy the code
- Horizontal and vertical center
background-position: center; Copy the code
- Set two edges, for example:
background-position: top right; /* upper right corner */ Copy the code
- If you set a single edge, the other direction will be centered, for example:
- Set the value
- To set a specific value, for example:
background-position: 20px 30px; /* horizontal 20px vertical 30px from the top left vertex; * / background-position: 50% 50%; /* Horizontal 50%, vertical 50%(container 50% and image 50% overlap)*/ Copy the code
- To set a specific value, for example:
- Set edges and values
background-positon: bottom 20px right 20px; Copy the code