4 properties, 7 selectors, 2 types defined by this
specification, 12 of them known to at least one browser
(the others are badged Not in any browser yet).
<div> <p> The effect of this property can be noticed when the document is being printed or a preview of a print is displayed. </p> <button id="print-btn">Show Print Preview</button> <div class="box-container"> <div class="box">Content before the property</div> <div class="box" id="example-element">Content with 'page-break-after'</div> <div class="box">Content after the property</div> </div></div>
<div> <p> The effect of this property can be noticed when the document is being printed or a preview of a print is displayed. </p> <button id="print-btn">Show Print Preview</button> <div class="box-container"> <div class="box">Content before the property</div> <div class="box" id="example-element">Content with 'page-break-before'</div> <div class="box">Content after the property</div> </div></div>
<div> <p> The effect of this property can be noticed when the document is being printed or a preview of a print is displayed. </p> <button id="print-btn">Show Print Preview</button> <div class="box-container"> <div class="box">Content before the property</div> <div class="box" id="example-element">Content with 'page-break-inside'</div> <div class="box">Content after the property</div> </div></div>
PropertyBaseline: widely availablesince January 2018
MDN The z-indexCSS property sets the z-order of a positioned element and its descendants or flex and grid items. Overlapping elements with a larger z-index cover those with a smaller one.
Live previewExample from MDN
#example-element { top: 15px; left: 15px; width: 180px; height: 230px; position: absolute; /* center the text so it is visible even when z-index is set to auto */ line-height: 215px; font-family: monospace; background-color: #fcfbe5; border: solid 5px #e3e0a1; z-index: auto; color: black;}.container { display: inline-block; width: 250px; position: relative;}.block { width: 150px; height: 50px; position: absolute; font-family: monospace; color: black;}.blue { background-color: #e5e8fc; border: solid 5px #112382; /* move text to the bottom of the box */ line-height: 55px;}.red { background-color: #fce5e7; border: solid 5px #e3a1a7;}.position1 { top: 0; left: 0; z-index: 6;}.position2 { top: 30px; left: 30px; z-index: 4;}.position3 { top: 60px; left: 60px; z-index: 2;}.position4 { top: 150px; left: 0; z-index: auto;}.position5 { top: 180px; left: 30px; z-index: auto;}.position6 { top: 210px; left: 60px; z-index: auto;}
<section class="default-example container" id="default-example"> <div id="example-element">Change my z-index</div> <div class="block blue position1">z-index: 6</div> <div class="block blue position2">z-index: 4</div> <div class="block blue position3">z-index: 2</div> <div class="block red position4">z-index: auto</div> <div class="block red position5">z-index: auto</div> <div class="block red position6">z-index: auto</div></section>
Syntax
auto | <integer> | inherit
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Definition
Initial
auto
Applies to
positioned elements
Inherited
no
Percentages
N/A
Computed value
as specified
Canonical order
per grammar
Animation type
by computed value type
Browser support
First browser version supporting z-index
Chrome
1
Edge
12
Firefox
1
Safari
1
Chrome Android
18
Safari iOS
1
First version with support, from MDN browser-compat-data.
SelectorBaseline: widely availablesince January 2018
MDN In CSS, ::after creates a pseudo-element that is the last child of the selected element. It is often used to add cosmetic content to an element with the content property. It is inline by default.
<p> The sailfish is named for its sail-like dorsal fin and is widely considered the fastest fish in the ocean. <a href="https://en.wikipedia.org/wiki/Sailfish" >You can read more about it here</a >.</p><p> The red lionfish is a predatory scorpionfish that lives on coral reefs of the Indo-Pacific Ocean and more recently in the western Atlantic. <a href="" class="dead-link">You can read more about it here</a>.</p>
Syntax
:after
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting :after
Chrome
1
Edge
12
Firefox
1.5
Safari
4
Chrome Android
18
Safari iOS
3.2
First version with support, from MDN browser-compat-data.
SelectorBaseline: widely availablesince January 2018
MDN In CSS, ::before creates a pseudo-element that is the first child of the selected element. It is often used to add cosmetic content to an element with the content property. It is inline by default.
<p> Learning resources for web developers can be found all over the internet. Try out <a href="https://web.dev/">web.dev</a>, <a href="https://www.w3schools.com/">w3schools.com</a> or our <a href="https://developer.mozilla.org/" class="local-link">MDN web docs</a>.</p>
Syntax
:before
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting :before
Chrome
1
Edge
12
Firefox
1.5
Safari
4
Chrome Android
18
Safari iOS
3
First version with support, from MDN browser-compat-data.
Spec Authors may also specify style for the first page of a document with the :first pseudo-class:
MDN The :firstCSSpseudo-class, used with the @pageat-rule, represents the first page of a printed document. (See :first-child for general first element of a node.)
SelectorBaseline: widely availablesince January 2018
MDN The ::first-letterCSSpseudo-element applies styles to the first letter of the first line of a block container, but only when not preceded by other content (such as images or inline tables).
<p> Scientists exploring the depths of Monterey Bay unexpectedly encountered a rare and unique species of dragonfish. This species is the rarest of its species.</p><p> When Robison and a team of researchers discovered this fish, they were aboard a week-long expedition.</p>
Syntax
:first-letter
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting :first-letter
Chrome
1
Edge
12
Firefox
1
Safari
1
Chrome Android
18
Safari iOS
1
First version with support, from MDN browser-compat-data.
<p> In warm ocean waters around the world, you may see a strange sight: A fish leaping from the water and soaring dozens of meters before returning to the ocean's depths. Early Mediterranean sailors thought these flying fish returned to the shore at night to sleep, and therefore called this family of marine fish Exocoetidae.</p>
Syntax
:first-line
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting :first-line
Chrome
1
Edge
12
Firefox
1
Safari
1
Chrome Android
18
Safari iOS
1
First version with support, from MDN browser-compat-data.
Spec All pages are automatically classified by user agents into either the :left or :right pseudo-class. Whether the first page of a document is :left or :right depends on the major writing direction of the root element. For example, the first page of a document with a left-to-right major writing direction would be a :right page, and the first page of a document with a right-to-left major writing direction would be a :left page. To explicitly force a document to begin printing on a left or right page, authors can insert a page break before the first generated box.
MDN The :leftCSSpseudo-class, used with the @pageat-rule, represents all left-hand pages of a printed document.
Syntax
:left
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting :left
Chrome
6
Edge
12
Firefox
No
Safari
5
Chrome Android
18
Safari iOS
4.2
First version with support, from MDN browser-compat-data.
Spec All pages are automatically classified by user agents into either the :left or :right pseudo-class. Whether the first page of a document is :left or :right depends on the major writing direction of the root element. For example, the first page of a document with a left-to-right major writing direction would be a :right page, and the first page of a document with a right-to-left major writing direction would be a :left page. To explicitly force a document to begin printing on a left or right page, authors can insert a page break before the first generated box.
MDN The :rightCSSpseudo-class, used with the @pageat-rule, represents all right-hand pages of a printed document.
Syntax
:right
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting :right
Chrome
6
Edge
12
Firefox
No
Safari
5
Chrome Android
18
Safari iOS
4.2
First version with support, from MDN browser-compat-data.
Spec In the example above, the last value is a generic family name. The following generic families are defined: serif (e.g., Times) sans-serif (e.g., Helvetica) cursive (e.g., Zapf-Chancery) fantasy (e.g., Western) monospace (e.g., Courier) Style sheet designers are encouraged to offer a generic font family as a last alternative. Generic font family names are keywords and must NOT be quoted.
MDN The <generic-family>CSSdata type represents the keyword values for generic font families used in the font shorthand and font-family longhand properties. The <generic-family> represents one or more locally-installed fonts belonging to that category of fonts.
Spec In CSS 2, the only valid <shape> value is: rect(<top>, <right>, <bottom>, <left>) where <top> and <bottom> specify offsets from the top border edge of the box, and <right>, and <left> specify offsets from the left border edge of the box. Authors should separate offset values with commas. User agents must support separation with commas, but may also support separation without commas (but not a combination), because a previous revision of this specification was ambiguous in this respect. <top>, <right>, <bottom>, and <left> may either have a <length> value or auto. Negative lengths are permitted. The value auto means that a given edge of the clipping region will be the same as the edge of the element’s generated border box (i.e., auto means the same as 0 for <top> and <left>, the same as the used value of the height plus the sum of vertical padding and border widths for <bottom>, and the same as the used value of the width plus the sum of the horizontal padding and border widths for <right>, such that four auto values result in the clipping region being the same as the element’s border box). When coordinates are rounded to pixel coordinates, care should be taken that no pixels remain visible when <left> and <right> have the same value (or <top> and <bottom> have the same value), and conversely that no pixels within the element’s border box remain hidden when these values are auto.
MDN The <shape>CSSdata type defines the specific form (shape) of a region. The region represents the part of an element to which the clip property applies.
Syntax
rect(<top>, <right>, <bottom>, <left>)
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting <shape>
Chrome
1
Edge
12
Firefox
1
Safari
1.3
Chrome Android
18
Safari iOS
1
First version with support, from MDN browser-compat-data.