CSS3 common attributes (a)

Original link: https://www.mk2048.com/blog/blog.php?id=h0212cj2ka1j&title=CSS3%E7%9A%84%E5%B8%B8%E7%94%A8%E5%B1%9E%E6 % 80% A7% EF% BC % 88% E4% B8% 80% EF% BC% 89

Selector

Attribute selector (selected by tag attributes)

  • E [attr]: that as long as the element <E> attr presence attributes can be selected as: div [class]
  • E [attr = val]: represents an element of <E> is equal to presence attributes attr val, can be selected as: div [class = "val" ]
  • E [attr * = val]: represents an element of <E> attr present value of the attribute comprises a val, and in any position, such as: div [class * = "text_val "]
  • E [attr ^ = val]: represents an element of <E> contains the value of presence attributes attr val, and at the start position as: div [class ^ = "val_one "]
  • E [attr $ = val]: represents an element of <E> attr present value of the attribute comprises a val, and the end position, such as: div [class $ = "two_val "]

Pseudo class selector

  • E: first-child: select all elements of the first child element <E> (the pseudo-class is misleading, and is defined in the CSS2)
    • p: first-child selector matches any element represents the first child element <p>
    • p> i: first-child matches the first selector indicates all child element <p> element <i>
    • p: first-child i represents all <i> element selector matches any first child element <p> in
  • E: last-child: select last child element (the E: first-child similar)
  • E: nth-child (n) : choose child elements of all the elements <E>, and <E> element is in line with the rules established by the n
    • E: nth-child (3): select the first sub-elements 3 <E>
    • E: nth-child (n): When all of the selected sub-element <E>, n as follows a linear change from 0,1,2,3,4 ...... When n <= 0, selected
    • E: nth-child (2n-1): Select all of the odd <E>
    • E: nth-child (-n 5): Select prior 5 <E> Note: E: nth-child (5-n) write no effect
    • E: nth-last-child (-n 5): After selecting 5 <E>
    • E: nth-child (even): Select all of the even sub-element <E> added: E: all the odd-nth-child (odd)
  • E: empty: Select no content of <E> elements, including spaces
  • E: target: binding anchor for use, due to the current anchor elements will be selected
  • E: not (selector): the elements are other selector (selector any) is selected outer
  • Other less common pseudo class selector such as: : Nth-of-type () , : Nth-Last-of-type () , : First-of-type , : Last-of-type , : only-Child , : only -of-type , etc.

Pseudo-element selector

  • E :: before, E :: after: inside the element <E> to create a start and end element, the element is inline elements, attributes and content to be combined using
    special note: these two selectors are in the old version among pseudo-class selector (pseudo-element concept does not exist), the new version E: before, E: after will be automatically identified as E :: befote, E :: after
  • E :: first-letter: The first letter or word of text
  • E :: first-line: first line of text
  • E :: selection: the selected text style

 

colour

  • rgba (0,0,0,0.1): color space, a new color representation, wherein R (red), G (green ), B (blue), A (alpha, opacity)
  • HSLA (200 is,,,. 1??): H (Hue, hue, ranges from 0 to 360, where 0/360 represents red, 120 for green, and 240 represents blue), S (saturation, saturation, value range of 0% ~ 100%), L (lightness, luminance, in the range 0% ~ 100%), A (alpha, opacity, ranging from 0 to 1)
    added: opacity (opacity) only for the whole box setting, the box and its contents son inherited his father's box opacity will, and rgba, hsla can be applied to any set of local color, and does not have inheritance

 

Text shadow

  • text-shadow: may be respectively offset, blur, color (transparency can be provided)
    • Horizontal offset: positive to the right, left negative
    • Vertical offset: positive downward, upward negative
    • Ambiguity can not be negative
      illustration:
      文字凸起:
      .tu{
      text-shadow: -1px -1px 1px #fff, 1px 1px 1px #000;      
      }
      .ao{
      text-shadow: -1px -1px 1px #000, 1px 1px 1px #fff;
      }

 

Box Model

  • box-sizing: CSS is specified by the box-sizing box model; box-sizing has two values; are:
    • content-box: the actual width of the box plus a value equal to the border width value plus a padding value is the default value
    • border-box: width value is set equal to the actual width of the box, even if the definition of the border and padding, does not change the actual width of the box

More professional front-end knowledge, make the [2048] ape www.mk2048.com

Guess you like

Origin blog.csdn.net/weixin_39037804/article/details/102758632