MindMap Gallery HTML03_Margin_Rounded Border_Box Shadow_Stability_Float_Common
Margins_rounded borders_box shadow_stability_floating_common layout notes
Edited at 2019-07-24 02:35:15This is a mind map about bacteria, and its main contents include: overview, morphology, types, structure, reproduction, distribution, application, and expansion. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about plant asexual reproduction, and its main contents include: concept, spore reproduction, vegetative reproduction, tissue culture, and buds. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about the reproductive development of animals, and its main contents include: insects, frogs, birds, sexual reproduction, and asexual reproduction. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about bacteria, and its main contents include: overview, morphology, types, structure, reproduction, distribution, application, and expansion. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about plant asexual reproduction, and its main contents include: concept, spore reproduction, vegetative reproduction, tissue culture, and buds. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about the reproductive development of animals, and its main contents include: insects, frogs, birds, sexual reproduction, and asexual reproduction. The summary is comprehensive and meticulous, suitable as review materials.
HTML05
margins
Block-level box center alignment
margin: 0 auto; core changes the left and right of the box to auto
Width must be set
Clear the inner and outer margins (usually done at the beginning)
* { margin: 0; padding: 0; }
Margin merging problem (whichever is the largest)
1. Merging of vertical margins of adjacent block elements
This is a browser regulation and cannot be solved. Try to avoid this situation.
2. Merging vertical margins of nested block elements
border
You can define a 1-pixel top border or top padding for the parent element
padding
Add overflow:hidden to the parent element
rounded border
border-radius: percentage/px
Turn a square into a circle
There are two units: px and %
The effect is the same when the angle is 90° and the side length of the angle is set.
You can also specify four corners at the same time
Same as border
border-radius: 1px 1px 1px 20px;
Upper left Upper right Lower right Lower left
border-radius: 10px 0;
box shadow
box-shadow: horizontal shadow, vertical shadow, blur distance (virtual and real), shadow size (shadow size), shadow color, inner/outer shadow;
The position of the horizontal shadow and the position of the vertical shadow are required and negative values are allowed.
Outer shadow (outset) is the default value, you don’t need to write it. If you want inner shadow, add inset
Three common layouts
float
standard stream
Normal display method: one block-level element is displayed per line, and inline elements are displayed multiple times per line.
Function: It allows any box to be arranged in a row for easy layout
Although you can use display:inline-block to display the div in one line, it is too troublesome if you want to move it left or right.
The floating of an element refers to the process in which an element with the floating attribute set will break away from the control of the standard flow and move to a specified position in its parent element.
Float is off-standard
1. Floating inside the parent box will not exceed the range of the padding and border.
2. If one sub-box is floated, the rest of the sub-boxes should be floated.
3. Default implicit conversion of inline block elements
4. Floating affects the box below
Insider Features
1. Float first creates the concept (wrapper) of the containing block. That is, a floated element is always aligned with its nearest parent element. But it will not exceed the range of the padding.
2. For a child box inside a parent box, if one of the children is floated, the other children need to be floated. This will allow the display to be aligned in one line.
3. After adding float to an element, the element will have the characteristics of an inline block element. The size of the element depends entirely on the defined size or the default content float. The corresponding float is displayed based on the writing position of the element.
Box model layout stability
Q: When should I use padding and when should I use margins?
Answer: In fact, they can be mixed in most cases. That is to say, you can use inner margins or outer margins. Use whichever one you find more convenient
It is recommended to use priority:
width > padding > margin