Latest web development tutorials
×

CSS Reference Manual

CSS Reference Manual CSS Selector CSS Voice Reference CSS Web Secure Font CSS Animation CSS unit CSS Colour CSS Legal color values CSS The color name CSS Color Hexadecimal value CSS Browser support

CSS Attributes

align-content align-items align-self all animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function appearance backface-visibility background background-attachment background-blend-mode background-clip background-color background-image background-origin background-position background-repeat background-size border border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color border-image border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-left border-left-color border-left-style border-left-width border-radius border-right border-right-color border-right-style border-right-width border-spacing border-style border-top border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-width bottom box-align box-direction box-flex box-flex-group box-lines box-ordinal-group box-orient box-pack box-shadow box-sizing caption-side clear clip color column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width columns content counter-increment counter-reset cursor direction display empty-cells filter flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap float font @font-face font-family font-size font-size-adjust font-stretch font-style font-variant font-weight grid-columns grid-rows hanging-punctuation height icon justify-content @keyframes left letter-spacing line-height list-style list-style-image list-style-position list-style-type margin margin-bottom margin-left margin-right margin-top max-height max-width @media min-height min-width nav-down nav-index nav-left nav-right nav-up opacity order outline outline-color outline-offset outline-style outline-width overflow overflow-x overflow-y padding padding-bottom padding-left padding-right padding-top page-break-after page-break-before page-break-inside perspective perspective-origin position punctuation-trim quotes resize right rotation tab-size table-layout target target-name target-new target-position text-align text-align-last text-decoration text-decoration-color text-decoration-line text-decoration-style text-indent text-justify text-outline text-overflow text-shadow text-transform text-wrap top transform transform-origin transform-style transition transition-delay transition-duration transition-property transition-timing-function unicode-bidi vertical-align visibility white-space width word-break word-spacing word-wrap z-index

CSS selectors

CSS selectors are used to select the elements you want to style pattern.

"CSS" column indicates in which CSS properties defined (CSS1, CSS2, or CSS3).

Selector Example Example shows CSS
. Class .intro Select all the class = "intro" element 1
# Id #firstname Select all the id = "firstname" elements 1
* * Select all the elements 2
elementp Select all <p> elements 1
element, elementdiv,p Select all the <div> element and the <p> element 1
element element div p Select <div> all <p> elements within the element 1
element> element div>p Select all the parent is a <div> element of the <p> element 2
element + element div+p Select <p> element followed by all <div> elements after 2
[Attribute] [target] Select all the elements with the target attribute 2
[Attribute = value] [target=-blank] Select all use target = - element "blank" of 2
[Attribute ~ = value] [title~=flower] Select all the elements of the title attribute contains the word "flower" of 2
[Attribute | = language] [lang|=en] Select all the elements of a lang attribute start value = "EN" of 2
: link a:link Select all unvisited links 1
: visited a:visited Select all visited links 1
: active a:active Select the active link 1
: hover a:hover When you select the mouse on the link above 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 each <P> The first line element 1
: first-child p:first-child Specified only when <p> element is the first child of its parent style. 2
: before p:before Insert content before each <p> element 2
: after p:after Insert content after each <p> element 2
: lang (language) p:lang(it) Select a lang attribute start value = "it" all <p> elements 2
element1 ~ element2 p ~ ul Each choice p ul element after element 3
[Attribute ^ = value] a [src ^ = "https"] Select each src attribute value to "https" at the beginning of the element 3
[Attribute $ = value] a [src $ = ". pdf"] Select each src attribute value to ".pdf" at the end of the element 3
[Attribute * = value] a [src * = "w3big"] Select each element src attribute value contains the substring "w3big" of 3
: first-of-type p: first-of-type Select each p p element is the first element of its parent 3
: last-of-type p: last-of-type Select each p element is the last element of its parent p 3
: only-of-type p: only-of-type Select each p element is the only element of its parent p 3
: only-child p: only-child Select each p element is the only child element of its parent 3
: nth-child (n) p: nth-child (2) Select each p element is the second child of its parent 3
: nth-last-child (n ) p: nth-last-child (2) Select each p element is the second child of its parent, counting from the last child 3
: nth-of-type (n ) p: nth-of-type (2) Select each p element is the second p element of its parent 3
: nth-last-of-type (n) p: nth-last-of-type (2) Select each p element is the second p element of its parent, counting from the last child 3
: last-child p: last-child Select each p element is the last child of its parent. 3
: root : Root Select the root element of the document 3
: empty p: empty Select each of the p element has no children (including text nodes) 3
: target #news: target Select the currently active #news element (including the anchor name clickable URL) 3
: enabled input: enabled Select each input element enabled 3
: disabled input: disabled Selecting each input element disabled 3
: checked input: checked Select each selected input element 3
: not (selector) : Not (p) Select each element is not p elements 3
:: selection :: Selection Element is selected or highlighted in the state of the user partial match 3
: out-of-range : Out-of-range Matching value input element outside the specified range 3
: in-range : In-range Matching value input element within the specified range of the 3
: read-write : Read-write It used to match readable and writable element 3
: read-only : Read-only For matching set "readonly" (read-only) attribute element 3
: optional : Optional For matching optional input element 3
: required : Required Set up to match the element "required" property 3
: valid : Valid Used to match the input value is a legitimate element 3
: invalid : Invalid Illegal value for the input element matches 3