CSS finishing

CSS box model:
Here Insert Picture Description

More details >>>


CSS three quoting ways:

  • Inline
  • Embedded
  • External formula

CSS weight:

  • Refers to the weight CSS style priority, there are two or more patterns applied to the same elements, high weight piece element acting styles, weights the same style, the style will overwrite the previous write writing style.

Weight-rating:

  1. ! Important- added after the style property values, the weight is 10000 (highest)
  2. Inline styles - weight value 1000
  3. ID selector - weight value 1000
  4. Class, and the class attribute selector pseudo - weighted value of 10
  5. Tag pseudo-element selector and the selector - a weight value
  6. Universal selector (*) child selector (>) adjacent selector (+) fellow selector (~) - weight value 0

Comprehensive CSS selectors:

Selector example Examples of description CSS
.class .intro Select class = "intro" all the elements. 1
#id #firstname Select all elements = "firstname" the id. 1
* * Select all the elements. 2
element p Select all <p> element. 1
element,element div,p Select all the <div> element and all <p> elements. 1
element element div p Select <div> inside all of the elements <p> element. 1
element>element div>p All <p> element is selected parent element <div> element. 2
element+element div+p Select immediately after the <div> element in all <p> elements. 2
[attribute] [target] Select all elements with a target attribute. 2
[attribute=value] [target=_blank] Select target = "_ blank" in all elements. 2
[attribute~=value] [title~=flower] Select the title attribute contains the word "flower" of all the elements. 2
[attribute|=value] [Lang | = one] Select all the elements in order to "en" lang beginning of the property value. 2
:link a:link Select all the links have not been accessed. 1
:visited a:visited Select all the links have been visited. 1
:active a:active Select the active link. 1
:hover a:hover Select which link the mouse pointer is on. 1
:focus input:focus Select the input element has focus. 2
:first-letter p:first-letter Select the first letter of each <p> element. 1
:first-line p:first-line Select the first line of each <p> element. 1
:first-child p:first-child Select each <p> element belonging to the first child of the parent element of the element. 2
:before p:before Insert content before the content of each <p> element. 2
:after p:after Insert after the content of each <p> element. 2
:lang(language) p:lang(it) 选择带有以 "it" 开头的 lang 属性值的每个 <p> 元素。 2
element1~element2 p~ul 选择前面有 <p> 元素的每个 <ul> 元素。 3
[attribute^=value] a[src^="https"] 选择其 src 属性值以 "https" 开头的每个 <a> 元素。 3
[attribute$=value] a[src$=".pdf"] 选择其 src 属性以 ".pdf" 结尾的所有 <a> 元素。 3
[attribute*=value] a[src*="abc"] 选择其 src 属性中包含 "abc" 子串的每个 <a> 元素。 3
:first-of-type p:first-of-type 选择属于其父元素的首个 <p> 元素的每个 <p> 元素。 3
:last-of-type p:last-of-type 选择属于其父元素的最后 <p> 元素的每个 <p> 元素。 3
:only-of-type p:only-of-type 选择属于其父元素唯一的 <p> 元素的每个 <p> 元素。 3
:only-child p:only-child 选择属于其父元素的唯一子元素的每个 <p> 元素。 3
:nth-child(n) p:nth-child(2) 选择属于其父元素的第二个子元素的每个 <p> 元素。 3
:nth-last-child(n) p:nth-last-child(2) 同上,从最后一个子元素开始计数。 3
:nth-of-type(n) p:nth-of-type(2) 选择属于其父元素第二个 <p> 元素的每个 <p> 元素。 3
:nth-last-of-type(n) p:nth-last-of-type(2) 同上,但是从最后一个子元素开始计数。 3
:last-child p:last-child 选择属于其父元素最后一个子元素每个 <p> 元素。 3
:root :root 选择文档的根元素。 3
:empty p:empty 选择没有子元素的每个 <p> 元素(包括文本节点)。 3
:target #news:target 选择当前活动的 #news 元素。 3
:enabled input:enabled 选择每个启用的 <input> 元素。 3
:disabled input:disabled 选择每个禁用的 <input> 元素 3
:checked input:checked 选择每个被选中的 <input> 元素。 3
:not(selector) :not(p) 选择非 <p> 元素的每个元素。 3
::selection ::selection 选择被用户选取的元素部分。 3
Published 21 original articles · won praise 3 · Views 343

Guess you like

Origin blog.csdn.net/MrLsss/article/details/104087524