Positioning methods

The five properties are positioning css property position

Attribute value length direction are such 50px

Position of the property value

relative Relative positioning: positioning relative to their original position. And also before occupied space.

absolute absolute positioning:

If an element is set absolute / fixed, it looks to the parent if there is a position property, if it is to parent as a reference point, if not continue to look to the parent of the parent, if there is to attribute to the parent position parent as a reference point, if not continue to look up in this way, until you find, if they did not have a window to the body as a reference point.

Referred to as the father of the child must phase.

Fixed Fixed positioning

Absolute and fixed once set, the element will flow out of the document.

Margin

Element of a set margin, the attribute value length. A total of four margin are margin-top, margin-right, margin-bottom, margin-left.

Margin shorthand

Margin: 10px 20px 30px 40px; left on the lower right representative.

Margin: Next 10px 20px 30px representatives about.

Margin: 10px 20px; representatives up and down

Margin: 10px; left on the lower right representative.

Padding and margin shorthand same.

  1. Standard stream, margin is not superimposed in the vertical direction, whichever is the greatest.

If the standard is not shed, margin will be superimposed.

  1. Margin is best not to use elements between father and son, used between siblings. Preferably between father and son with padding.

Guess you like

Origin www.cnblogs.com/zhangyuxinxin/p/11933055.html