Quản lý CSS note

Thêm mới CSS note

Nonameexampledescriptiontranslate
1.class.introSelects all elements with class="intro"
2.class1.class2.name1.name2Selects all elements with both name1 and name2 set within its class attribute
3.class1 .class2.name1 .name2Selects all elements with name2 that is a descendant of an element with name1
4#id#firstnameSelects the element with id="firstname"
5**Selects all elements
6ElementpSelects all <p> elements
7Element.classp.introSelects all <p> elements with class="intro"
8Element,elementdiv, pSelects all <div> elements and all <p> elements
9Element elementdiv pSelects all <p> elements inside <div> elements
10Element>elementdiv > pSelects all <p> elements where the parent is a <div> element
11Element+elementdiv + pSelects the first <p> element that is placed immediately after <div> elements
12Element1~element2p ~ ulSelects every <ul> element that is preceded by a <p> element
13[attribute][target]Selects all elements with a target attribute
14[attribute=value][target=_blank]Selects all elements with target="_blank"
15[attribute~=value][title~=flower]Selects all elements with a title attribute containing the word "flower"
16[attribute|=value][lang|=en]Selects all elements with a lang attribute value starting with "en"
17[attribute^=value]a[href^="https"]Selects every <a> element whose href attribute value begins with "https"
18[attribute$=value]a[href$=".pdf"]Selects every <a> element whose href attribute value ends with ".pdf"
19[attribute*=value]a[href*="w3schools"]Selects every <a> element whose href attribute value contains the substring "w3schools"
20:activea:activeSelects the active link
21::afterp::afterInsert something after the content of each <p> element
22::beforep::beforeInsert something before the content of each <p> element
23:checkedinput:checkedSelects every checked <input> element
24:defaultinput:defaultSelects the default <input> element
25:disabledinput:disabledSelects every disabled <input> element
26:emptyp:emptySelects every <p> element that has no children (including text nodes)
27:enabledinput:enabledSelects every enabled <input> element
28:first-childp:first-childSelects every <p> element that is the first child of its parent
29::first-letterp::first-letterSelects the first letter of every <p> element
30::first-linep::first-lineSelects the first line of every <p> element
31:first-of-typep:first-of-typeSelects every <p> element that is the first <p> element of its parent
32:focusinput:focusSelects the input element which has focus
33:fullscreen:fullscreenSelects the element that is in full-screen mode
34:hovera:hoverSelects links on mouse over
35:in-rangeinput:in-rangeSelects input elements with a value within a specified range
36:indeterminateinput:indeterminateSelects input elements that are in an indeterminate state
37:invalidinput:invalidSelects all input elements with an invalid value
38:lang(language)p:lang(it)Selects every <p> element with a lang attribute equal to "it" (Italian)
39:last-childp:last-childSelects every <p> element that is the last child of its parent
40:last-of-typep:last-of-typeSelects every <p> element that is the last <p> element of its parent
41:linka:linkSelects all unvisited links
42::marker::markerSelects the markers of list items
43:not(selector):not(p)Selects every element that is not a <p> element
44:nth-child(n)p:nth-child(2)Selects every <p> element that is the second child of its parent
45:nth-last-child(n)p:nth-last-child(2)Selects every <p> element that is the second child of its parent, counting from the last child
46:nth-last-of-type(n)p:nth-last-of-type(2)Selects every <p> element that is the second <p> element of its parent, counting from the last child
47:nth-of-type(n)p:nth-of-type(2)Selects every <p> element that is the second <p> element of its parent
48:only-of-typep:only-of-typeSelects every <p> element that is the only <p> element of its parent
49:only-childp:only-childSelects every <p> element that is the only child of its parent
50:optionalinput:optionalSelects input elements with no "required" attribute
51:out-of-rangeinput:out-of-rangeSelects input elements with a value outside a specified range
52::placeholderinput::placeholderSelects input elements with the "placeholder" attribute specified
53:read-onlyinput:read-onlySelects input elements with the "readonly" attribute specified
54:read-writeinput:read-writeSelects input elements with the "readonly" attribute NOT specified
55:requiredinput:requiredSelects input elements with the "required" attribute specified
56:root:rootSelects the document's root element
57::selection::selectionSelects the portion of an element that is selected by a user
58:target#news:target Selects the current active #news element (clicked on a URL containing that anchor name)
59:validinput:validSelects all input elements with a valid value
60:visiteda:visitedSelects all visited links
61Attr()attr(href)Returns the value of an attribute of the selected element
62Calc()width: calc(100% - 20px);Allows you to perform calculations to determine CSS property values
63Cubic-bezier()transition: width 0.2s; transition-timing-function: cubic-bezier(0.1, 0.7, 1.0, 0.1);Defines a Cubic Bezier curve
64Hsl()background-color:hsl(120,100%,50%);Defines colors using the Hue-Saturation-Lightness model (HSL)
65Hsla()background-color:hsla(290,100%,50%,0.3);}Defines colors using the Hue-Saturation-Lightness-Alpha model (HSLA)
66Linear-gradient()background-image: linear-gradient(red, yellow, blue);Sets a linear gradient as the background image. Define at least two colors (top to bottom)
67Radial-gradient()background-image: radial-gradient(red, green, blue);Sets a radial gradient as the background image. Define at least two colors (center to edges)
68Repeating-linear-gradient()background-image: repeating-linear-gradient(red 10%, yellow 10%, green 20%);Repeats a linear gradient
69Repeating-radial-gradient()background-image: repeating-radial-gradient(red, yellow 10%, green 15%);Repeats a radial gradient
70Rgb()background-color:rgb(0,255,0);Defines colors using the Red-Green-Blue model (RGB)
71Rgba()background-color:rgba(255,0,0,0.3);Defines colors using the Red-Green-Blue-Alpha model (RGBA)
72Var():root {--main-bg-color: orange;} #div1 {background-color: var(--main-bg-color);}Inserts the value of a custom property
73Arial (sans-serif)font-family: Arial, sans-serif;
74Verdana (sans-serif)font-family: Verdana, sans-serif;
75Helvetica (sans-serif)font-family: Helvetica, sans-serif;
76Tahoma (sans-serif)font-family: Tahoma, sans-serif;
77Trebuchet MS (sans-serif)font-family: 'Trebuchet MS', sans-serif;
78Times New Roman (serif)font-family: 'Times New Roman', serif;
79Georgia (serif)font-family: Georgia, serif;
80Garamond (serif)font-family: Garamond, serif;
81Courier New (monospace)font-family: 'Courier New', monospace;
82Brush Script MT (cursive)font-family: 'Brush Script MT', cursive;
83@keyframes@keyframes mymove {from {background-color: red;}to {background-color: blue;}}#myDIV {animation: mymove 5s infinite;}