css

Synopsis

CSS is a language for describing the presentation of Web pages, including colors, layout, and fonts. It allows one to adapt the presentation to different types of devices, such as large screens, small screens, or printers. CSS is independent of HTML and can be used with any XML-based markup language.

CSS Properties

Syntax: property-name : value;

Some common values to all properties: inherit / initial / revert / revert-layer / unset

Property NameDescriptionValues (Separated by /)
align-contentAligns a flex container’s lines within the flex container when there is extra space in the cross-axisflex-start / flex-end / center / space-between / space-around / space-evenly / stretch / start / end / baseline / first baseline / last baseline / safe center / unsafe center
align-itemsAligns flex items of the current line the same way as justify-contentflex-start / flex-end / center / baseline / stretch
align-selfAligns flex items of the current line the same way as justify-contentauto / flex-start / flex-end / center / baseline / stretch
allSets all the propertiesinitial / inherit / unset
animationA shorthand property for all the animation-* propertiesSyntax: animation-name animation-duration animation-timing-function animation-delay animation-iteration-count animation-direction animation-fill-mode animation-play-state
animation-delayDefines when the animation will starttime / %
animation-directionDefines whether the animation should play in reverse on alternate cyclesnormal / reverse / alternate / alternate-reverse
animation-durationDefines how long an animation should take to complete one cycletime / %
animation-fill-modeDefines a style for the target element when the animation is not playing (when it is finished, or when it has a delay)none / forwards / backwards / both
animation-iteration-countDefines the number of times an animation should be playednumber / infinite
animation-nameSpecifies a name for the @keyframes animationnone / keyframes-name
animation-play-stateDefines whether the animation is running or pausedrunning / paused
animation-timing-functionDefines the speed curve of the animationease / linear / ease-in / ease-out / ease-in-out / cubic-bezier(n,n,n,n)
backface-visibilityDefines whether or not the back face of an element should be visible when facing the uservisible / hidden
backgroundA shorthand property for all the background-* propertiesSyntax background-color background-image background-position background-size background-repeat background-origin background-clip background-attachment background-blend-mode
background-attachmentSets whether a background image scrolls with the rest of the page, or is fixedscroll / fixed / local
background-blend-modeSpecifies the blending mode of each background layer (color/image)normal / multiply / screen / overlay / darken / lighten / color-dodge / saturation / color / luminosity
background-clipSpecifies how far the background (color or image) should extend within an elementborder-box / padding-box / content-box
background-colorSets the background color of an elementcolor
background-imageSets one or more background images for an elementurl(image-path) / none
background-originSpecifies the origin position of a background imagepadding-box / border-box / content-box
background-positionSets the starting position of a background imagetop left / top center / top right / center left / center center / center right / bottom left / bottom center / bottom right / x-axis y-axis / x-axis / y-axis
background-repeatThe way the background image is repeatedrepeat / repeat-x / repeaty / no-repeat
background-sizeBackground image sizelength / percentage / auto / cover / contain
borderSets all border properties in one lineSyntax: top right bottom left / top-bottom left-right / all-at-once
border-bottomBottom border properties in one lineSyntax: width style color
border-bottom-colorColor of the bottomcolor (RGB, HEX, name) / transparent
border-bottom-left-radiusBorder bottom left radiuslength / percentage
border-bottom-right-radiusBorder bottom right radiuslength / percentage
border-bottom-styleBorder bottom stylenone / hidden / dotted / dashed / solid / double / groove / ridge / inset / outset
border-bottom-widthBorder bottom widthlength / percentage
border-collapseCollapses the borders between table cellscollapse / separate
border-colorSets all border color properties in one lineSyntax: top right bottom left / top-bottom left-right / all-at-once
border-imageShorthand property for border-image-*Syntax: source slice width outset repeat
border-image-outsetOutset of the border imagelength / number
border-image-repeatHow the border image is repeatedstretch / repeat / round
border-image-sliceSlices the border imagenumber / percentage
border-image-sourceSource of the border imageurl (path to image) / none
border-image-widthWidth of the border imagelength / percentage / number
border-leftLeft border properties in one lineSyntax: width style color
border-left-colorColor of the left bordercolor (RGB, HEX, name) / transparent
border-left-styleStyle of the left bordernone / hidden / dotted / dashed / solid / double / groove / ridge / inset / outset
border-left-widthWidth of the left borderlength / percentage
border-radiusSets all border radius properties in one lineSyntax: top-left top-right bottom-right bottom-left / top-bottom left-right / all-at-once
border-rightRight border properties in one lineSyntax: width style color
border-right-colorColor of the right bordercolor (RGB, HEX, name) / transparent
border-right-styleStyle of the right bordernone / hidden / dotted / dashed / solid / double / groove / ridge / inset / outset
border-right-widthWidth of the right borderlength / percentage
border-spacingSpacing between the cellslength / percentage
border-styleSets all border style properties in one lineSyntax: top right bottom left / top-bottom left-right / all-at-once
border-topTop border properties in one lineSyntax: width style color
border-top-colorColor of the top bordercolor (RGB, HEX, name) / transparent
border-top-left-radiusBorder top left radiuslength / percentage
border-top-right-radiusBorder top right radiuslength / percentage
border-top-styleStyle of the top bordernone / hidden / dotted / dashed / solid / double / groove / ridge / inset / outset
border-top-widthWidth of the top borderlength / percentage
border-widthSets all border width properties in one lineSyntax: top right bottom left / top-bottom left-right / all-at-once
bottomDistance from the bottom of the elementlength / percentage / auto
box-shadowAdds shadow to the boxSyntax: h-offset v-offset blur spread color inset
box-sizingDefines how the width and height of the element are calculatedcontent-box / border-box
caption-sidePosition of the table captiontop / bottom
caret-colorColor of the caretcolor (RGB, HEX, name) / auto
clearSpecifies on which sides of an element floating elements are not allowednone / left / right / both
clipClipping regionrect (top right bottom left) / auto
colorText colorcolor (RGB, HEX, name) / transparent
column-countNumber of columnsnumber / auto
column-fillHow to fill columnsbalance / auto
column-gapGap between the columnslength / percentage
column-ruleSets all column rule properties in one lineSyntax: width style color
column-rule-colorColor of the column rulecolor (RGB, HEX, name) / transparent
column-rule-styleStyle of the column rulenone / hidden / dotted / dashed / solid / double / groove / ridge / inset / outset
column-rule-widthWidth of the column rulelength / percentage
column-spanHow many columns an element should span acrossnone / all
column-widthWidth of the columnslength / percentage
columnsSets all column properties in one lineSyntax: column-width column-count
contentUsed with the ::before and ::after pseudo-elements, to insert generated contentstring / url (path to image) / none
counter-incrementIncreases or decreases the value of one or more CSS counterscounter-name value
counter-resetResets one or more CSS counterscounter-name value
cursorSpecifies the mouse cursor to be displayed when pointing over an elementauto / default / none / context-menu / help / pointer / progress / wait / cell / crosshair / text / vertical-text / alias / copy / move / no-drop / not-allowed / e-resize / n-resize / ne-resize / nw-resize / s-resize / se-resize / sw-resize / w-resize / ew-resize / ns-resize / nesw-resize / nwse-resize / col-resize / row-resize / all-scroll / zoom-in / zoom-out / grab / grabbing
directionSpecifies the text direction/writing directionltr / rtl
displaySpecifies how a certain HTML element should be displayednone / inline / block / inline-block / list-item / run-in / compact / marker / table / inline-table / table-row-group / table-header-group / table-footer-group / table-row / table-column-group / table-column / table-cell / table-caption / ruby / ruby-base / ruby-text / ruby-base-container / ruby-text-container / contents / flow / flow-root / table / flex / inline-flex / grid / inline-grid / ruby-base-group / ruby-text-group
empty-cellsSpecifies whether or not to display borders and background on empty cells in a tableshow / hide
filterDefines effects (e.g. blurring or color shifting) on an element before the element is displayednone / url (path to SVG filter) / blur (length) / brightness (percentage) / contrast (percentage) / drop-shadow (h-offset v-offset blur spread color) / grayscale (percentage) / hue-rotate (angle) / invert (percentage) / opacity (percentage) / saturate (percentage) / sepia (percentage)
flexSets all flex properties in one lineSyntax: flex-grow flex-shrink flex-basis
flex-basisSpecifies the initial length of a flexible itemlength / auto
flex-directionSpecifies the direction of the flexible itemsrow / row-reverse / column / column-reverse
flex-flowSets all flex flow properties in one lineSyntax: flex-direction flex-wrap
flex-growSpecifies how much the item will grow relative to the restnumber
flex-shrinkSpecifies how the item will shrink relative to the restnumber
flex-wrapSpecifies whether the flexible items should wrap or notnowrap / wrap / wrap-reverse
floatSpecifies whether or not a box should floatleft / right / none
fontSets all font properties in one lineSyntax: font-style font-variant font-weight font-size/line-height font-family
font-familySpecifies the font family for textfont-name / generic-family
font-feature-settingsControls advanced typographic features in OpenType fontsnormal / string
font-kerningControls the usage of the kerning informationauto / normal / none
font-language-overrideControls the usage of language-specific glyphs in a typefacenormal / string
font-sizeSpecifies the font size of textlength / percentage / xx-small / x-small / small / medium / large / x-large / xx-large / smaller / larger
font-size-adjustPreserves the readability of text when font fallback occursnone / number
font-stretchSelects a normal, condensed, or expanded face from a font familynormal / ultra-condensed / extra-condensed / condensed / semi-condensed / semi-expanded / expanded / extra-expanded / ultra-expanded
font-styleSpecifies the font style for textnormal / italic / oblique
font-synthesisControls which missing typefaces (bold or italic) may be synthesized by the browsernone / weight / style / weight style
font-variantSpecifies whether or not a text should be displayed in a small-caps fontnormal / small-caps / all-small-caps / petite-caps / all-petite-caps / unicase / titling-caps
font-variant-alternatesControls the usage of alternate glyphs associated to alternative names defined in @font-feature-valuesnormal / string
font-variant-capsControls the usage of alternate glyphs for capital lettersnormal / small-caps / all-small-caps / petite-caps / all-petite-caps / unicase / titling-caps
font-variant-east-asianControls the usage of alternate glyphs for East Asian scriptsnormal / string
font-variant-ligaturesControls which ligatures and contextual forms are used in textual content of the elements it applies tonormal / none / string
font-variant-numericControls the usage of alternate glyphs for numbers, fractions, and ordinal markersnormal / ordinal / slashed-zero / lining-nums / oldstyle-nums / proportional-nums / tabular-nums / diagonal-fractions / stacked-fractions
font-variant-positionControls the usage of alternate glyphs of smaller size positioned as superscript or subscript regarding the baseline of the fontnormal / sub / super
font-weightSpecifies the weight of a fontnormal / bold / bolder / lighter / 100 / 200 / 300 / 400 / 500 / 600 / 700 / 800 / 900
gridSets all grid properties in one lineSyntax: grid-template-rows grid-template-columns grid-template-areas grid-auto-rows grid-auto-columns grid-auto-flow grid-column-gap grid-row-gap
grid-areaSpecifies a name for the grid itemgrid-row-start / grid-column-start / grid-row-end / grid-column-end
grid-auto-columnsSpecifies the size of an implicitly-created column tracklength / percentage / auto
grid-auto-flowSpecifies how auto-placed items are inserted in the gridrow / column / row dense / column dense
grid-auto-rowsSpecifies the size of an implicitly-created row tracklength / percentage / auto
grid-columnSpecifies a grid item’s size and location within the grid column by referring to specific grid linesgrid-column-start / grid-column-end
grid-column-endSpecifies where to end the grid itemgrid-column-line
grid-column-gapSpecifies the size of the gap between columnslength / percentage
grid-column-startSpecifies where to start the grid itemgrid-column-line
grid-gapSets the gap between the rows and columnsSyntax: grid-row-gap grid-column-gap
grid-rowSpecifies a grid item’s size and location within the grid row by referring to specific grid linesgrid-row-start / grid-row-end
grid-row-endSpecifies where to end the grid itemgrid-row-line
grid-row-gapSpecifies the size of the gap between rowslength / percentage
grid-row-startSpecifies where to start the grid itemgrid-row-line
grid-templateSets all grid template properties in one lineSyntax: grid-template-rows grid-template-columns grid-template-areas
grid-template-areasSpecifies how to display columns and rows, using named grid itemsnone / string
grid-template-columnsSpecifies the size of the columns, and how many columns in a grid layoutnone / track-list
grid-template-rowsSpecifies the size of the rows in a grid layoutnone / track-list
heightSets the height of an elementlength / percentage / auto
hyphensSpecifies how to split words to improve the layout of paragraphsnone / manual / auto
image-orientationSpecifies the orientation of an imageangle / from-image
image-renderingGives a hint to the browser about what aspects of an image are most important to preserve when the image is scaledauto / optimizeSpeed / optimizeQuality
image-resolutionSpecifies the intended resolution for a raster imagefrom-image / resolution
ime-modeSpecifies the state of the Input Method Editor for text fieldsauto / normal / active / inactive / disabled
initial-letterSpecifies the styling of dropped, raised, and sunken initial lettersnormal / number / length / percentage
initial-letter-alignSpecifies the alignment of an initial letterauto / alphabetic / hanging / ideographic / mathematical
initial-letter-wrapSpecifies whether the initial letter may be wrapped to the next linenormal / first / all
inline-sizeSets the width or height of an inline box, depending on the value of the writing-mode propertylength / percentage / auto
justify-contentSpecifies the alignment between the items inside a flexible container when the items do not use all available spaceflex-start / flex-end / center / space-between / space-around / space-evenly / start / end / left / right
justify-itemsSpecifies the alignment for items inside a flexible containerauto / normal / stretch / start / end / center / self-start / self-end / left / right / baseline / first baseline / last baseline / safe center / unsafe center
justify-selfSpecifies the alignment for selected items inside a flexible containerauto / normal / stretch / start / end / center / self-start / self-end / left / right / baseline / first baseline / last baseline / safe center / unsafe center
leftSpecifies the left position of a positioned elementlength / percentage / auto
letter-spacingIncreases or decreases the space between characters in a textnormal / length
line-breakSpecifies how/if to break linesauto / loose / normal / strict / anywhere
line-heightSpecifies the line heightnormal / number / length / percentage
list-styleSets all the properties for a list in one declarationSyntax: list-style-type list-style-position list-style-image
list-style-imageSpecifies an image as the list-item markernone / url
list-style-positionSpecifies the position of the list-item markers (bullet points)inside / outside
list-style-typeSpecifies the type of list-item markernone / disc / circle / square / decimal / decimal-leading-zero / lower-roman / upper-roman / lower-greek / lower-latin / upper-latin / armenian / georgian / lower-alpha / upper-alpha / hebrew / cjk-ideographic / hiragana / hiragana-iroha / katakana / katakana-iroha
marginSets all the margin properties in one declarationSyntax: margin-top margin-right margin-bottom margin-left
margin-block-endSets the margin at the bottom of an elementlength / percentage / auto
margin-block-startSets the margin at the top of an elementlength / percentage / auto
margin-bottomSets the bottom margin of an elementlength / percentage / auto
margin-inline-endSets the margin on the right side of an elementlength / percentage / auto
margin-inline-startSets the margin on the left side of an elementlength / percentage / auto
margin-leftSets the left margin of an elementlength / percentage / auto
margin-rightSets the right margin of an elementlength / percentage / auto
margin-topSets the top margin of an elementlength / percentage / auto
max-heightSets the maximum height of an elementlength / percentage / none
max-inline-sizeSets the maximum width or height of an inline box, depending on the value of the writing-mode propertylength / percentage / none
max-widthSets the maximum width of an elementlength / percentage / none
min-block-sizeSets the minimum height or width of an element, depending on the value of the writing-mode propertylength / percentage
min-heightSets the minimum height of an elementlength / percentage
min-inline-sizeSets the minimum width or height of an element, depending on the value of the writing-mode propertylength / percentage
min-widthSets the minimum width of an elementlength / percentage
mix-blend-modeSpecifies how an element’s content should blend with its direct parent backgroundnormal / multiply / screen / overlay / darken / lighten / color-dodge / saturation / color / luminosity
object-fitSpecifies how the contents of a replaced element should be fitted to the box established by its used height and widthfill / contain / cover / none / scale-down
object-positionSpecifies the alignment of the replaced element inside its boxx-axis y-axis / x-axis / y-axis / center
offsetSets all the offset properties in one declarationSyntax: offset-path offset-distance offset-rotate offset-anchor
offset-anchorSpecifies the position of the origin of an element’s offsetauto / x-axis y-axis / x-axis / y-axis / center
offset-distanceSpecifies the distance between the origin of an element’s offset and its offset pathlength / percentage / auto
offset-pathSpecifies the path the element should follownone / path() / <basic-shape> / <geometry-box>
offset-positionSets all the offset-position properties in one declarationSyntax: offset-path offset-distance offset-rotate
offset-rotateSpecifies how an element should be rotated along the offset pathauto / angle / reverse
opacitySets the opacity level for an elementnumber
orderSpecifies the order of the flexible item, relative to the restinteger
orphansSpecifies the minimum number of lines that must be left at the bottom of a page when a page break occurs inside an elementinteger
outlineSets all the outline properties in one declarationSyntax: outline-width outline-style outline-color
outline-colorSets the color of an outlinecolor
outline-offsetOffsets an outline, and draws it beyond the border edgelength
outline-styleSets the style of an outlinenone / hidden / dotted / dashed / solid / double / groove / ridge / inset / outset
outline-widthSets the width of an outlinethin / medium / thick / length
overflowSpecifies what happens if content overflows an element’s boxvisible / hidden / scroll / auto / overlay / clip
overflow-wrapSpecifies whether or not the browser may break lines within words in order to prevent overflow (when a string is too long to fit its containing box)normal / break-word / anywhere
overflow-xSpecifies whether or not to clip the left/right edges of the content, if it overflows the element’s content areavisible / hidden / scroll / auto / overlay / clip
overflow-ySpecifies whether or not to clip the top/bottom edges of the content, if it overflows the element’s content areavisible / hidden / scroll / auto / overlay / clip
paddingSets all the padding properties in one declarationSyntax: padding-top padding-right padding-bottom padding-left
padding-block-endSets the padding at the bottom of an elementlength / percentage
padding-block-startSets the padding at the top of an elementlength / percentage
padding-bottomSets the bottom padding of an elementlength / percentage
padding-inline-endSets the padding on the right side of an elementlength / percentage
padding-inline-startSets the padding on the left side of an elementlength / percentage
padding-leftSets the left padding of an elementlength / percentage
padding-rightSets the right padding of an elementlength / percentage
padding-topSets the top padding of an elementlength / percentage
page-break-afterSpecifies the page-breaking behavior after an elementauto / always / avoid / left / right
page-break-beforeSpecifies the page-breaking behavior before an elementauto / always / avoid / left / right
page-break-insideSpecifies the page-breaking behavior inside an elementauto / avoid
perspectiveGives a 3D-positioned element some perspectivenone / length
perspective-originDefines at which position the user is looking at the 3D-positioned elementx-axis y-axis / x-axis / y-axis / center
place-contentSets the align-content and justify-content properties in one declarationSyntax: align-content justify-content
place-itemsSets the align-items and justify-items properties in one declarationSyntax: align-items justify-items
place-selfSets the align-self and justify-self properties in one declarationSyntax: align-self justify-self
pointer-eventsDefines whether or not an element reacts to pointer eventsauto / none / visiblePainted / visibleFill / visibleStroke / visible / painted / fill / stroke / all
positionSpecifies the type of positioning method used for an element (static, relative, absolute or fixed)static / relative / absolute / fixed / sticky
quotesSpecifies how quotation marks should looknone / string string string string
resizeSpecifies whether or not an element is resizable by the usernone / both / horizontal / vertical / block / inline
rightSpecifies the right position of a positioned elementlength / percentage / auto
row-gapSets the size of the gap between an element’s grid rowslength / percentage
scroll-behaviorSpecifies whether to smoothly animate the scroll position in a scrollable box, instead of a straight jumpauto / smooth
tab-sizeSpecifies the width of a tab characternumber / length
table-layoutSpecifies the algorithm used to lay out table cells, rows, and columnsauto / fixed
text-alignSpecifies the horizontal alignment of textleft / right / center / justify / justify-all / start / end / match-parent
text-align-lastSpecifies the alignment of the last line of a block elementauto / left / right / center / justify / start / end
text-combine-uprightSpecifies how to combine multiple characters into the space of a single characternone / all / digits
text-decorationSets all the text-decoration properties in one declarationSyntax: text-decoration-line text-decoration-color text-decoration-style text-decoration-thickness
text-decoration-colorSpecifies the color of the text-decorationcolor
text-decoration-lineSpecifies the type of line in a text-decorationnone / underline / overline / line-through / blink
text-decoration-skipSpecifies what parts of an element’s content are skipped over when applying any text decorationnone / objects / spaces / ink
text-decoration-styleSpecifies the style of the line in a text decorationsolid / double / dotted / dashed / wavy
text-decoration-thicknessSpecifies the thickness of the line in a text decorationauto / from-font / length
text-indentSpecifies the indentation of the first line in a text-blocklength / percentage
text-orientationSpecifies the orientation of the text in a linemixed / upright / sideways / sideways-right / sideways-left / use-glyph-orientation
text-overflowSpecifies what should happen when text overflows the containing elementclip / ellipsis
text-renderingGives a fine-grained control over the algorithm used to render textauto / optimizeSpeed / optimizeLegibility / geometricPrecision
text-shadowAdds shadow to textnone / h-shadow v-shadow blur color
text-transformControls the capitalization of textnone / capitalize / uppercase / lowercase / full-width / full-size-kana
text-underline-offsetSpecifies the position of the underline which is set using the text-decoration propertyauto / length
text-underline-positionSpecifies the position of the underline which is set using the text-decoration propertyauto / under / left / right
topSpecifies the top position of a positioned elementlength / percentage / auto
touch-actionSpecifies whether and how a particular region can be manipulated by a userauto / none / pan-x / pan-left / pan-right / pan-y / pan-up / pan-down / pinch-zoom
transformApplies a 2D or 3D transformation to an elementnone / matrix() / matrix3d() / perspective() / rotate() / rotate3d() / rotateX() / rotateY() / rotateZ() / scale() / scale3d() / scaleX() / scaleY() / scaleZ() / skew() / skewX() / skewY() / translate() / translate3d() / translateX() / translateY() / translateZ()
transform-boxDefines the box to which the transform-origin property appliesborder-box / fill-box / view-box
transform-originAllows you to change the position on transformed elementsx-axis y-axis z-axis / x-axis y-axis / x-axis / y-axis / z-axis / left / center / right / top / bottom
transform-styleSpecifies how nested elements are rendered in 3D spaceflat / preserve-3d
transitionA shorthand property for all the transition-* propertiesSyntax: transition-property transition-duration transition-timing-function transition-delay
transition-delaySpecifies when the transition effect will starttime
transition-durationSpecifies how many seconds or milliseconds a transition effect takes to completetime
transition-propertySpecifies the name of the CSS property the transition effect is fornone / all / property
transition-timing-functionSpecifies the speed curve of the transition effectease / ease-in / ease-out / ease-in-out / linear / step-start / step-end / steps() / cubic-bezier()
unicode-bidiUsed together with the direction property to set or return whether the text should be overridden to support multiple languages in the same documentnormal / embed / bidi-override
user-selectSpecifies whether the text of an element can be selectedauto / none / text / all / contain
vertical-alignSets the vertical alignment of an elementbaseline / sub / super / top / text-top / middle / bottom / text-bottom / length / percentage
visibilitySpecifies whether or not an element is visiblevisible / hidden / collapse
white-spaceSpecifies how white-space inside an element is handlednormal / pre / nowrap / pre-wrap / pre-line / break-spaces
widthSets the width of an elementlength / percentage / auto
will-changeIndicates what will change before the element is actually changedauto / contents / scroll-position / transform
word-breakSpecifies how words should break when reaching the end of a linenormal / break-all / keep-all / break-word
word-spacingIncreases or decreases the space between words in a textnormal / length
word-wrapSpecifies whether or not the browser may break lines within words in order to prevent overflow (when a string is too long to fit its containing box)normal / break-word
writing-modeSpecifies whether lines of text are laid out horizontally or vertically and the direction which lines of text and blocks progresshorizontal-tb / vertical-rl / vertical-lr / sideways-rl / sideways-lr
z-indexSpecifies the stack order of an elementauto / number

CSS Selectors

CommandDescription
*all elements
divall ‘div’ tags
div.pall ‘div’ and ‘p’ paragraphs
div pparagraphs inside divs
div > pall ‘p’ tag one level deep in ‘div’
div + pp tags immediately after div
div ~ pp tags preceded by div
.class-nameall elements with class
#id-nameelement with ‘id’
div.class-namedivs with certain classname
div#id-namediv with certain ‘id’
#id-nameall elements iside that #id-name

CSS Pseudo Classes

CommandDescription
a:linklink in normal state
a:activelink in clicked state
a:hoverlink with mouse over it
a:visitedvisited link
p::after{content:"yo"/}add content after p
p::beforeadd content before p
input:checkedchecked inputs
input:disableddisabled inputs
input:enabledenabled inputs
input:focusinput has focus
input:in-rangevalue in range
input:out-of-rangeinput value out of range
input:validinput with valid value
input:invalidinput with invalid value
input:optionalno required attribute
input:requiredinput with requred attribute
input:read-onlywith readonly attribute
input:read-writeno readonly attrib.
div:emptyelement with no children
p::first-letterfirst letter in p
p::first-linefirst line in p
p:first-of-typefirst of some type
p:last-of-typelast of some type
p:lang(en)p with en language attribute
:not(span)element that’s not a span
p:first-childfirst child of its parent
p:last-childlast child of its parent
p:nth-child(2)second child of its parent
p:nth-child(3n+1)nth-child (an + b) formula
p:nth-last-child(2)second child from behind
p:nth-of-type(2)second p of its parent
p:nth-last-of-type(2)…from behind
p:only-of-typeunique of its parent
p:only-childonly child of its parent
:rootdocuments root element
::selectionportion selected by user
:targethighlight active anchor

CSS Attribute Selectors

CommandDescription
a[target]links with a target attribute
a[target="_blank"]links which open in new tab
[title~="chair"]title element containing a word
[class^="chair"]class starts with chair
[class="chair"]class starts with the chair word
[class*="chair"]class contains chair
[class$="chair"]class ends with chair
input[type="button"]specified input type