Properties box

Elastic layout

A box, if it is set to display property flex, the cartridge box becomes elastic (elastic container), all the child elements of the box, Item automatically becomes elastic. Flexible pouch according to its own positioning system are arranged, the influence of the resilient arrangement is only elastically resilient cartridge projects.

Attributes :

1.flex-direction: Change the direction of the spindle  

2.row line defaults

3.row-reverse reverse spindle from right to left

4.column column arrangement according to the spindle down from

5.column-reverse by the spindle from the bottom up

6.justify-content: Change the spindle on its way  

7.flex-start defaults starting point of a spindle arrangement

8.flex-end shaft end aligned

9.center spindle centerline alignment

About 10.space-between projects aside, the average distribution center

The average distribution 11.space-around all items

12.align-items: Change side shaft alignment  

Default stretching 13.stretch

14.flex-start aligned with the start point side shaft

15.flex-end side shaft end aligned

16.center side shaft centerline aligned

flex-wrap: wrap (wrap) nowrap (not wrapped)

align-content rules: the width of the elastic items automatically, the width and height of the content adaptation. automatic margin, the remaining space will absorb the elastic container.

Item Properties: order change the order of items of elasticity, the compression ratio of the order of small to large changes arranged flex-shrink elastic default item 1 0 no compression

flex-grow: Change the elastic proportional increase in the project 0 by default do not grow

flex-basis: Elastic projects based on the width of the front compression or growth, if not set, the default is auto, denote the same attribute value width

Sketch flex: grow shrink basis; also set to grow, compression, basic values.

Way horizontal center

1. Text the middle level, where the character elements arranged text-aline: center;

2. a conventional horizontal flow cassette center block, setting the width of about auto m argin

3. The cassette of parent element to the flexible pouch, and set justify-content: center;

4. Set the parent element is an elastic cassette, centered around the required elements margin set to auto.

Vertical center

1. Text is centered vertically in the element, set the row height to the height of the element.

2. box containing the vertical center block, set the parent element is an elastic cassette side shaft alignment is centered align-items: center.

3. Set the parent element to the flexible pouch and the required margin vertical centering elements disposed to auto.

Horizontal center (including the center block)

1. setting the width of the left and right margin auto. (Conventional block flow cartridge, the elastic project [not fixed width])

2. The flexible pouch set justify-content: center, let elasticity project centered on the spindle. (Universal adaptation)

3. parent element arranged text-align: center, let row inside the cartridge, the cartridge centering block.

4. Absolute positioning elements, left: 0; right: 0; fixed width; left margin: auto. 5.margin-left: 50%; transform: translateX (-50%). [Margin, padding block comprises a percentage of the width

Vertical center

1. The single line of text centered vertically disposed line-height of the parent element comprising a block height.

2. The flexible pouch disposed align-items: center, so that the elastic side project centered on the axis.

3. Absolute positioning elements, top: 0; bottom: 0; set high; vertical margin: auto.

4. Absolute positioning elements, top: 50%; transform: translateY (-50%).

The absolute positioning element vertically centered horizontally

left:50%;top:50%;transform:translate( -50%,-50%)

The difference between the row and the block cassette cartridge

1. The line width cartridge can not be set high, all dimensions does not occupy space in the vertical direction, but the margin, border in the horizontal direction, padding can. All the block size of the effective cartridge.

2. The row is truncated cassette in place, while not block boxes.

3. The cartridge only normal flow line (floating and absolute positioning will override the block is converted to the cartridge), when arranged in line contact with the other end to the cartridge. There are many block cartridge positioning system, the positioning system each arranged in its own rules.

4. The rows and lines between boxes box blank is folded internally. Will not block boxes.

Pseudo class selector

1.:hover, the suspension effect of the mouse

Effect when activated 2.:active,a/button element (button)

3.:link,a elements unvisited style

4.:visited,a visited style elements

5.:checked, or unit is selected from the selected style

6.:focus, form elements focused style

7.:firstchild, the first child

8.:lastchild, the last child

9.:nthchild(2), the second child element

10.: nthchild (2n) /: nthchild (even), the even sub-elements

11.: nthchild (odd), odd-numbered sub-elements

Pseudo-element selector

1. :: before, a sub-element is internally generated, as the first child, and then select it

2. :: after, a sub-element is internally generated, as the last child element, select it and then

3.: selection, select the marquee text

After \ 0: IE5 ~ IE7 before *: IE5 ~ IE7 ago _: IE5 ~ IE6

Color property, so that non-IE browser is green, IE5 ~ IE6 red, IE7 brown, IE8 ~ IE11 black color: green; color \ 0: black; * color: brown; _color: red;

The percentage with respect to the height comprises a height of the block, which is effective with the proviso that: a block comprising highly computable html set to 100%, is the height of the viewport.

CSS framework

bootstrap concept: the priority mobile terminal, responsive grid system (layout 960) 960 layouts: 960 pixel width of the main area, the inner area is divided into 12, the spacing between each column of pixels 10, the width of each column 60 of pixels.

Guess you like

Origin www.cnblogs.com/akangwx0624/p/10971481.html