Road css learning (a)

A, CSS selectors:

  1. Basic selector

    1.1 tag selector

      pa span div like {}

    1.2id selector

      #id名{}

    1.3 class selector

      . {} Class name

  2. Composite selector

    2.1 Descendant selectors

      div a {} // div select all tags inside a

    2.2 offspring selector

      div> a {} // child of the selected tag in a tag of div

    2.3 Set the selector and

      div, a, p {} // all selected div, a, p tag

    2.4 Intersection selector

      div.n1 {} // class name is selected div tag n1

    2.5 Link pseudo class selector

      a: hover {} // mouse over the link, and a label that was selected

 

Second, the label display mode

  Html mentioned here have to say that only three types of tags, also known element

  1. The block-level elements (block-level tab)

    Features:

      1.1 on a separate line display

      1.2 width and height may be provided

      1.3 The default width is the width of the parent element

      1.4 can be placed inside any one of three kinds of tab

  2. inline element (inline tag)

    Features:

      2.1 can talk to other lines within the same element on a single line display

      You can not set the width and height 2.2

      2.3 width is the width of the contents information itself

      2.4 accommodating only internal line of text or other elements

  3. The block elements within the row (row within the block tag)

    Features:

      3.1 with the same type of elements can be placed in the same line of the display, but there will be gaps between adjacent elements

      3.2 The default width is the width of the content itself

      3.3 width and height may be provided within and outside margins

  Return to the theme, the display mode tag is between these three types of label switching back and forth, the label only three types, each with their own label display rules

  For example, a line element I wanted to give it to set the width and height, but in itself is not set, this time I can make it display mode into a block or inline-block, so that you can for width and height are set up specifically select which of the two of you according to actual needs to decide.

 

Third, when the line height to width when the high single line of text will be centered vertically of

  Text line height = distance + text + the actual height

  

Four, CSS background

  

Five, CSS three characteristics

  1. The laminate of

    Css incorporated in three ways, the introduction line, introduction of internal and external introduction, if a plurality of selectors for setting the style of the same label, the display will inevitably overlap, depending on which display the final isolated recently, so three kind of way of introduction, it must be introduced within a line from the recent priority display inline style settings

  2. inheritance

    Between the tags are nested, assuming a parent tag more than one child tags, labels are not sub-set style, then the child will inherit the style tag of the parent tag, label if the sub-set style, the child will inherit the parent label but there is no sub-label label style

  3. Priority

    There are many CSS selectors, it exists between the selector priority,

      Priority order: d selector> class selector> tag selector> inheritance or *

    Of course, if the style is directly in the element itself to set up, no matter to control the element through which a selector style will give priority to select the style of the element itself

Guess you like

Origin www.cnblogs.com/pythonxiaocaicai/p/11922723.html
Recommended