The <angle>
CSS data type represents angle values. Positive angles represent right angles, negative angles represent left angles. Its syntax is a
<number>
data type immediately followed by the unit (deg
, grad
, rad
or turn
). Like for any CSS dimension, there is no space between the unit literal and the number.
For static properties and a given unit, an angle can be represented by several values: 90deg
and -270deg
, or 1turn
and 4turn
represents the same final position. For dynamic properties, like applying a
transition
on the
transform
property, the effect will nevertheless be different.
The following units may be used:
As all units represents the same angle for the value 0, the unit may be omitted in that case: 0
represents 0deg
, 0grad
, 0rad
, 0turn
.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 2 (528.17) | 3.6 (1.9.2) | 9.0 | no | 4.0 (528.17) |
turn unit | no | no | 9.0 | no | no |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | yes | ? | no | ? |
turn unit | no | no | ? | no | no |
See also
-
CSS Reference index
- CSS Data Types :
<angle>
, <color>
, <frequency>
, <identifier>
, <integer>
, <length>
, <number>
, <percentage>
, <ratio>
, <resolution>
, <shape>
, <string>
, <time>
, <timing-function>
, <uri>
« CSS « CSS Reference
DRAFT
This page is not complete.
Summary
The animation-delay
property specifies when the animation should start. This lets the animation sequence begin some time after it's applied to an element.
A value of 0 (the default) indicates that the animation should begin as soon as it's applied. Otherwise, the value specifies an offset from the moment the animation is applied to the element; animation will begin that amount of time after being applied.
Specifying a negative value for the animation delay causes the animation to begin executing immediately. However, it will appear to have begun executing partway through its cycle. For example, if you specify -1s as the animation delay time, the animation will begin immediately but will start 1 second into the animation sequence.
If you specify a negative value for the animation delay, but the starting value is implicit, the starting value is taken from the moment the animation is applied to the element.
It is often convenient to use the shorthand property
animation
to set all animation properties at once.
Syntax
animation-delay: <time> [, <time>]*
Values
<time>
- The time offset from the time at which the animation is applied to the element at which the animation should begin. This may be specified in either seconds (by specifying "s" as the unit) or milliseconds (by specifying "ms" as the unit). If you don't specify a unit, seconds are assumed.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 5.0 (5.0)
-moz
| 10
-ms [1]
| ? | 4.0
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
This is an experimental feature
Because this feature is still in development in some browsers, check the compatibility table for the proper prefixes to use in various browsers.
Summary
The animation-direction
CSS property indicates whether the animation should play in reverse on alternate cycles.
It is often convenient to use the shorthand property
animation
to set all animation properties at once.
Syntax
animation-direction: normal | alternate [, normal | alternate]*
Values
normal
- The animation should play forward each cycle. In other words, each time the animation cycles, the animation will reset to the beginning state and start over again. This is the default animation direction setting.
alternate
- The animation should reverse direction each cycle. When playing in reverse, the animation steps are performed backward. In addition, timing functions are also reversed; for example, an
ease-in
animation is replaced with an ease-out
animation when played in reverse.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 5.0 (5.0)
-moz
| 10
-ms [1]
| ? | 4.0
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The animation-duration
CSS property specifies the length of time that an animation should take to complete one cycle.
A value of 0 (the default) indicates that no animation should occur.
It is often convenient to use the shorthand property
animation
to set all animation properties at once.
Syntax
animation-duration: <time> [, <time>]*
Values
<time>
- The duration that an animation should take to complete one cycle. This may be specified in either seconds (by specifying "s" as the unit) or milliseconds (by specifying "ms" as the unit). If you don't specify a unit, seconds are assumed.
Note: Negative values are treated as 0.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 3.0
-webkit
| 5.0 (5.0)
-moz
| 10
-ms [1]
| -- | 4.0
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 2.0
-webkit
| 5.0 (5.0)
-moz
| -- | -- | 4.2
-webkit
|
« CSS « CSS Reference
DRAFT
This page is not complete.
Summary
The animation-fill-mode
property specifies how a CSS animation should apply styles to its target before and after it is executing.
Syntax
animation-fill-mode: none | forwards | backwards | both [, none | forwards | backwards | both]*
Values
- none
- The animation will not apply any styles to the target before or after it is executing.
- forwards
- The target will retain the computed values set by the last keyframe encountered during execution. This is usually the '100%' or 'to' keyframe, unless
animation-direction
is 'alternate' and
animation-iteration-count
is set to an even number, in which case it is the '0%' or 'to' keyframe. - backwards
- The animation will apply the values defined in the '0%' or 'from' keyframe as soon as it is applied to the target, and retain this during the
animation-delay
period. - both
- The animation will follow the rules for both forwards and backwards, thus extending the animation properties in both directions.
Examples
h1 {
animation-fill-mode: forwards;
}
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 5.0 (5.0)
-moz
| 10
-ms [1]
| ? | 4.0
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
This is an experimental feature
Because this feature is still in development in some browsers, check the compatibility table for the proper prefixes to use in various browsers.
Syntax
animation: [ <animation-name> || <animation-duration> || <animation-timing-function> || <animation-delay> ||
<animation-iteration-count> || <animation-direction>]
[, [<animation-name> || <animation-duration> || <animation-timing-function> || <animation-delay> ||
<animation-iteration-count> || <animation-direction>] ]*
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 5.0 (5.0)
-moz
| 10
-ms
| -- | 4.0
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | 5.0 (5.0)
-moz
| ? | -- | iOS 2.0
-webkit
|
« CSS « CSS Reference
DRAFT
This page is not complete.
Summary
The animation-iteration-count
CSS property defines the number of times an animation cycle should be played before stopping.
It is often convenient to use the shorthand property
animation
to set all animation properties at once.
Syntax
animation-iteration-count: infinite | <number> [, infinite | <number>]*
Values
infinite
- The animation will repeat forever.
<number>
- The number of times the animation should repeat; this is 1 by default. Negative values are treated like 0. You may specify non-integer values to play part of an animation cycle (for example 0.5 will play half of the animation cycle).
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 5.0 (5.0)
-moz
| 10
-ms [1]
| ? | 4.0
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
DRAFT
This page is not complete.
Summary
The animation-name
CSS property specifies a list of animations that should be applied to the selected element. Each name indicates a
@keyframes
at-rule that defines the property values for the animation sequence.
It is often convenient to use the shorthand property
animation
to set all animation properties at once.
Syntax
animation-name: none | <name> [, none | <name>]*
Values
<name>
- A string identifying the animation.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 5.0 (5.0)
-moz
| 10
-ms [1]
| ? | 4.0
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
DRAFT
This page is not complete.
Summary
The animation-play-state
CSS property determines whether an animation is running or paused. You can query this property's value to determine whether or not the animation is currently running; in addition, you can set its value to pause and resume playback of an animation.
Note: At this time, this property is being considered for removal from the specification, since its functionality can be simulated by other means.
Resuming a paused animation will start the animation from where it left off at the time it was paused, rather than starting over from the beginning of the animation sequence.
Syntax
animation-play-state: running | paused [, running | paused]*
Values
running
- The animation is currently playing.
paused
- The animation is currently paused.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 5.0 (5.0)
-moz
| ? | ? |
(Supported)
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
DRAFT
This page is not complete.
Summary
The animation-timing-function
property specifies how a CSS animation should progress over the duration of each cycle. The possible values are one or several
<timing-function>
.
For keyframed animations, the timing function applies between keyframes rather than over the entire animation. In other words, the timing function is applied at the start of the keyframe and at the end of the keyframe.
An animation timing function defined within a keyframe block applies to that keyframe; otherwise. If no timing function is specified for the keyframe, the timing function specified for the overall animation is used.
It is often convenient to use the shorthand property
animation
to set all animation properties at once.
Syntax
animation-timing-function: <timing-function> [, <timing-function>]*
where:
- Each
<timing-function>
represents the timing function to link to the corresponding property to animate, as defined in
animation-property
.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 5.0 (5.0)
-moz
| 10
-ms [1]
| ? | 4.0
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
Signifies a value that is to be automatically computed by a useragent. The specific effects of auto depend on the property to which it is applied as its value.
This is an experimental feature
Because this feature is still in development in some browsers, check the compatibility table for the proper prefixes to use in various browsers.
Summary
The backface-visibility
CSS property determines whether or not the back face of the element is visible when facing the user. The back face of an element always is a transparent background, letting, when visible, a mirror image of the front face be displayed.
There are cases when we do not want the front face of an element to be visible through the back face, like when doing a flipping card effect (setting two elements side-to-side).
Syntax
backface-visibility: visibility
where :
- visibility
- Is a keyword indicating if the backface must be visible or not. It can have the following values:
-
visible
meaning that the back face is visible, allowing the front face to be displayed mirrored; -
hidden
meaning that the back face is not visible, hiding the front face.
Examples
backface-visibility: visible; | backface-visibility: hidden; |
| Though not opaque, the front sides don't let the back faces of the hidden sides to be displayed. |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 12
-webkit
| 10.0 (10)
-moz
| 10
-ms
| -- |
(Supported)
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 3.0
-webkit
| 10.0 (10)
-moz
| ? | -- |
(Supported)
-webkit
|
« CSS « CSS Reference
Summary
If a
background-image
is specified, background-attachment
determines whether that image's position is fixed within the viewport, or scrolls along with its containing block.
Syntax
background-attachment: <attachment>[, <attachment>]*
Where:
- <attachment>
scroll | fixed | local
Gecko 1.9.2 note
Gecko 1.9.2 introduced support for multiple background images; prior to 1.9.2, only one value is supported.
Values
- scroll
- If
scroll
is specified, the background image will scroll within the viewport along with the block the image is contained within. - fixed
- If
fixed
is specified, the background image will not scroll with its containing element, instead remaining stationary within the viewport. - local
-
Unimplemented
in Gecko (Firefox)
Examples
View Live Examples
body {
background-image: url("images/cartooncat.png");
background-attachment: fixed;
}
Multiple background image support
Gecko 1.9.2 supports multiple background images. You can specify a different <attachment>
for each background, separated by commas:
body {
background-image: url("img1.png"), url("img2.png");
background-attachment: scroll, fixed;
}
Each image is matched with the corresponding attachment type, from first specified to last.
Browser Compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | 1.0 | 1.0 (1.7 or earlier)
| 4.0 | 3.5 | 1.0 |
Multiple backgrounds | 1.0 | 3.6 (1.9.2)
| 9.0 | 10.5 | 1.3 |
local | 4.0 |
-- [1]
| 9.0 | 10.5 | 5.0 |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 2.1 | 1.0 (1.9.2)
| ? | 10.0 | 3.2 |
Multiple backgrounds | 2.1 | 1.0 (1.9.2)
| ? | 10.0 | 3.2 |
local | ? |
-- [2]
| ? | ? | ? |
« CSS « CSS Reference
Summary
The background-clip
CSS property specifies whether an element's background, either the color or image, extends underneath its border.
-moz-background-clip
is supported up to Gecko version 1.9.2 (Firefox 3.6). To support both, older and newer versions of Gecko (Firefox), you have to add both properties in the stylesheet (see examples).
If there is no background-image, this property has only visual effect when the border has transparent regions (because of
border-style
) or partially opaque regions; otherwise the border covers up the difference.
Syntax
background-clip: [ border-box | padding-box | content-box][, [ border-box | padding-box | content-box]]*
-moz-background-clip: [border | padding][, [border | padding]]* /* Gecko 1.2-1.9.2 (Firefox 1.0-3.6) */
Values
- border-box
Requires Gecko 2.0
border (Firefox 1.0-3.6)
- The background extends to the outside edge of the border (but underneath the border in z-ordering).
Default value, but see Browser compatibility section below for special case Internet Explorer 7. - padding-box
Requires Gecko 2.0
padding (Firefox 1.0-3.6)
- No background is drawn below the border (background extends to the outside edge of the padding).
- content-box
Requires Gecko 2.0
- The background is painted within (clipped to) the content box.
Examples
pre {
border: 5px navy;
border-style: dotted double;
background: #F8D575;
/* The yellow background will not go behind the border */
-moz-background-clip: padding; /* Firefox 1.0-3.6 */
-webkit-background-clip: padding-box; /* Safari, Chrome */
background-clip: padding-box; /* Firefox 4.0+, Opera 10.5, Chrome */
}
Browser compatibility
Browser | Lowest version | Support of |
Chrome | 1.0 | -webkit-background-clip: padding | border | content
-webkit-background-clip: padding-box | border-box | content-box |
1.0 | background-clip: padding-box | border-box background-clip: padding-box | border-box | content-box
|
Firefox (Gecko) | 1.0-3.6 (1.2-1.9.2) | -moz-background-clip: padding | border |
4.0 (2.0) | background-clip: padding-box | border-box | content-box
|
Internet Explorer | 9.0 [*] | background-clip: padding-box | border-box | content-box |
Opera | 10.5 | background-clip: padding-box | border-box |
Safari (WebKit) | 3.0 (522) |
-webkit-background-clip: padding | border | content
-webkit-background-clip: padding-box | border-box | content-box
|
- [*] IE 7 (not other versions of IE) behaves like
background-clip:padding
if overflow: hidden | auto | scroll
.
- Konqueror 3.5.4 supports
-khtml-background-clip
.
« CSS « CSS Reference
Summary
background-color
sets the background color of an element, either through a color value or the keyword transparent
.
Syntax
background-color: color | transparent | inherit
Values
- color
- The color can be specified as a hexadecimal RGB value, a regular RGB value, or by using one of the pre-defined color keywords.
- transparent
- The default value for
background-color
is transparent
meaning the element has no color of its own, instead showing the color of the element behind it.
Examples
View Live Examples
.exampleOne {
background-color: teal;
color: white;
}
.exampleTwo {
background-color: rgb(153,102,153);
color: rgb(255,255,204);
}
.exampleThree {
background-color: #666699;
color: #FFFFFF;
}
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 (1.7 or earlier)
| 1.0 | 4.0 | 3.5 | 1.0 (85) |
Feature | Firefox Mobile (Gecko) | Android | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 1.0 (1.9.2)
| (Supported) | (Supported) | (Supported) | (Supported) |
« CSS « CSS Reference
Syntax
background: [<bg-layer>, ]* <final-bg-layer>
Where:
- <bg-layer>
[ <background-image> || <background-repeat> || <background-attachment> || <background-position> ]
|
inherit
- <final-bg-layer>
[ <background-color> || <background-image> || <background-repeat> || <background-attachment> || <background-position> ]
|
inherit
|| <background-color>
Gecko 1.9.2 note
(Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0)
Support for multiple backgrounds was added in Gecko 1.9.2; prior to this, only a single background could be specified.
Gecko 2.0 note
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
introduced support for using SVG images as CSS backgrounds.
Examples
View Live Examples
body { background: red; }
.topbanner { background: url("topbanner.png") #00D repeat-y fixed; }
Notes
The background
property first sets the individual background properties to their initial values, then assigns the explicit values specified in the declaration. You do not have to define a value for each of the individual properties, only those you want to change from their initial defaults.
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 1.0 (1.7 or earlier)
| 1.0 | 4.0 | 3.5 | 1.0 |
Multiple backgrounds | 3.6 (1.9.2)
| 1.0 | 9.0 | 10.5 | 1.3 |
Feature | Firefox Mobile (Gecko) | Android | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 1.0 (1.9.2)
| 2.1 | ? | 10.0 | 3.2 |
Multiple backgrounds | 1.0 (1.9.2)
| 2.1 | ? | 10.0 | 3.2 |
« CSS « CSS Reference
Summary
The background-image
CSS property sets the background image for an element. It is often more convenient to use the shorthand
background
.
Syntax
background-image: <bg-image>[, <bg-image>]*
Where:
- <bg-image>
<uri>
| <gradient> | none
Gecko 1.9.2 note
Support for multiple, comma-separated, background images was added in Gecko 1.9.2.
Gecko 2.0 note
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Starting in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
, you can use SVG images as CSS backgrounds.
Values
- <uri>
- The location of the image resource to be used as a background image.
- none
- Used to specify that an element is to have no background image.
Examples
View Live Examples
body { background-image: url("images/darkpattern.png"); }
div { background-image: url("images/foo.png"), url("images/bar.png"); }
p { background-image: none; }
Notes
Developers should ensure that they specify a
background-color
to be used if an image is not available. Background images are rendered on top of the background color.
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 1.0 (1.7 or earlier)
| 1.0 | 4.0 | 3.5 | 1.0 |
Multiple backgrounds | 3.6 (1.9.2)
| 1.0 | 9.0 | yes | 1.3 |
Gradients | 3.6 (1.9.2)
-moz
| 1.0
-webkit
| -- | -- | 4.0
-webkit
|
SVG background | 4.0 (2.0)
| 8.0 | 9.0 | 9.5 | 5.0 |
Feature | iOS Safari | Opera Mini | Opera Mobile | Android Browser |
Basic support | yes | yes | yes | yes |
Multiple backgrounds | yes | yes | yes | yes |
Gradients | yes
-webkit
| ? | ? | yes
-webkit
|
SVG background | yes, but see below | yes | yes | -- |
Notes
- Support of SVG in CSS background is incomplete in the current version of iOS Safari (4.2-4.3). The same for Safari prior 5.0.
« CSS « CSS Reference
Summary
The background-origin
CSS property determines the background positioning area (the origin of a background-image).
background-origin
does not apply when
background-attachment
is fixed
.
This property is reset to its initial value by the
background
shorthand property.
Syntax
/* since Gecko 2.0 (Firefox 4.0) */
background-origin: [padding-box | border-box | conten
t-box
][, [border-box | padding-box | conten
t-box
]]*
/* older versions (multiple backgrounds since Gecko 1.9.2 / Firefox 3.6) */
-moz-background-origin: [padding | border | conten
t
][, [border | padding | conten
t
]]*
Values
- padding-box
New in Firefox 4
padding (Firefox 1.0-3.6)
- Default value. The background position is relative to the padding. (For single boxes "
0 0
" is the upper left corner of the padding edge, "100% 100%
" is the lower right corner.) - border-box
New in Firefox 4
border (Firefox 1.0-3.6)
- The background position is relative to the border, so the image can go behind the border.
- content-box
New in Firefox 4
content (Firefox 1.0-3.6)
- The background position is relative to the content.
Examples
.example {
border: 10px double;
padding: 10px;
background: url('image.jpg');
background-position: center left;
/* The background will be inside the padding */
-moz-background-origin: content; /* Firefox 1.0-3.6 */
-webkit-background-origin: content-box; /* Safari, Chrome */
background-origin: content-box; /* Firefox 4.0+ */
}
div {
background-image: url('mainback.png'), url('logo.jpg');
background-position: 0px 0px, top right;
-moz-background-origin: padding, content;
-webkit-background-origin: padding-box, content;
background-origin: padding-box, content-box;
}
Browser compatibility
Browser | Lowest version | Support of |
Chrome | 1.0 |
-webkit-background-origin: padding | border | content
-webkit-background-origin: padding-box | border-box | content-box
|
1.0 |
background-origin: padding | border | content
background-origin: padding-box | border-box | content-box
|
Firefox (Gecko) | 1.0-3.6 (1.2-1.9.2) | -moz-background-origin: padding | border | content |
4.0 (2.0) | background-origin: padding-box | border-box | content-box |
Internet Explorer | 9.0 [*] | background-origin: padding-box | border-box | content-box |
Opera | 10.5 | background-origin: padding-box | border-box | content-box |
Safari (WebKit) | 3.0 (522) | -webkit-background-origin: padding | border | content |
4.0 | -webkit-background-origin: padding-box | border-box | content-box |
5.0 | background-origin: padding-box | border-box | content-box |
- [*] IE up to version 7 behaves as if it were
background-origin: border-box;
- [**] IE 8 behaves as if it were
background-origin: padding-box;
- Konqueror 3.5.4 supports
-khtml-background-origin
.
« CSS « CSS Reference
Summary
The background-position
CSS property sets the initial position of any background image that has been set.
It is often more convenient to use the shorthand
background
.
Syntax
background-position: <bg-position>[, <bg-position>]*
background-position: [
<percentage>
|
<length>
| left | center | right ]
[ <percentage> | <length> | top | center | bottom ]?
background-position: [ top | center | bottom ]
background-position:
inherit
Where:
- <bg-position> is one of:
[
<percentage>
|
<length>
| left | center | right ]
[ <percentage> | <length> | top | center | bottom ]?
[ top | center | bottom ]
inherit
Values
Accepts one or two values, up to four values in supporting browsers. Negative
<percentage>
and
<length>
values are allowed.
- If only one value is specified, the second value is assumed to be
center
. - The first value represents the horizontal position and the second represents the vertical position (if at least one value is not a keyword).
The specifications allow for 4 values enabling offsetting a background image from any corner, not just the top left. If four values are specified, they must include two sides and two offsets. This is not yet fully supported in all browsers.
<percentage>
- With a value pair of
0% 0%,
(is equal to 0 0
) the upper left corner of the image is aligned with the upper left corner of the box's padding edge. A value pair of 100% 100%
places the lower right corner of the image in the lower right corner of padding area. With a value pair of 14% 84%
, the point 14% across and 84% down the image is to be placed at the point 14% across and 84% down the padding area. <length>
- With a value pair of
2cm 1cm
, the upper left corner of the image is placed 2cm to the right and 1cm below the upper left corner of the padding area. top
- Equivalent to
0%
for the vertical position. right
- Equivalent to
100%
for the horizontal position. bottom
- Equivalent to
100%
for the vertical position. left
- Equivalent to
0%
for the horizontal position. center
- Equivalent to
50%
for the horizontal position if it is not otherwise given, or 50%
for the vertical position if it is.
Examples
View the live example
.exampleone {
background-image: url("logo.png");
background-position: top;
}
.exampletwo {
background-image: url("logo.png");
background-position: 25% 75%;
}
.examplethree {
background: url("logo.png") 2cm bottom;
}
.examplefour {
background-image: url("logo.png");
background-position: center 10%;
}
.examplefive {
background: url("logo.png") 3em 50%;
}
.examplesix {
background-image: url("logo.png");
background-position: right 20px bottom 20px;
Multiple background image support
Gecko 1.9.2 supports multiple background images. You can specify a different <bg-position>
for each background, separated by commas:
.examplesix {
background-image: url("img1.png"), url("img2.png");
background-position: 0px 0px, center;
}
Each image is matched with the corresponding position style, from first specified to last.
Browser compatibility
Browser | Lowest version | Multiple Backgrounds | Four values |
Chrome | 1.0 | 1.0 | -- |
Firefox (Gecko) | 1.0 (1.0) | 3.6 (1.9.2) | -- |
Internet Explorer | 4.0 | 9.0 | 9.0 |
Opera | 3.5 | 10.5 | 10.5 |
Safari (WebKit) | 1.0 (85) | 1.3 (312) | -- |
« CSS « CSS Reference
Summary
background-repeat
specifies whether the image is repeated (tiled), and how.
Syntax
background-repeat: <repeat-style>[, <repeat-style>]*
Where:
- <repeat-style>
repeat | repeat-x | repeat-y | no-repeat | inherit | round | space
Gecko 1.9.2 note
Gecko 1.9.2 added support for multiple background repeat values.
Values
- repeat
- The image is repeated both horizontally and vertically.
- repeat-x
- The image is repeated horizontally only.
- repeat-y
- The image is repeated vertically only.
- no-repeat
- The image is not repeated; only one copy of the image is drawn.
- space
- The image is repeated as many times as can fully fit, separated by white space if repeating does not create an exact fit.
- round
- The image is repeated as often as will fit. If it doesn't fit a whole number of times, the background images are rescaled so they do.
If a <repeat-style>
value specifies two keywords, the first is for the horizontal direction and the second is for the vertical direction.
Examples
View the live example
.exampleone {
background-image: url("logo.png");
background-repeat: repeat-x;
}
.exampletwo {
background-image: url("logo.png");
background-repeat: no-repeat;
}
Multiple background image support
Gecko 1.9.2 supports multiple background images. You can specify a different <repeat-style>
for each background, separated by commas:
.examplethree {
background-image: url("img1.png"), url("img2.png");
background-repeat: repeat-x, repeat-y;
}
Each image is matched with the corresponding repeat style, from first specified to last.
Browser compatibility
Browser | Lowest Version | Space | Round | Multiple Backgrounds | Different Values for X & Y |
Chrome | 1.0 | -- | 1.0 | √ |
Firefox (Gecko) | 1.0 (1.0) | -- | 3.6 (1.9.2) | -- |
Internet Explorer | 4.0 | 9.0 | 9.0 | 9.0 |
Opera | 3.5 | 10.5 | 10.5 | √ |
Safari (Webkit) | 1.0 (85) | -- | 1.3 (312) | √ |
Round / Space values are supported in IE9+ and Opera 11+
Summary
The background-size
CSS property specifies the size of the background images.
Syntax
background-size: <bg-size>[, <bg-size>]* /* Gecko 2.0 (Firefox 4.0) and later */
Where <bg-size> is one of:
Multiple values apply to individual background layers, from front to back, in the same manner as for all other background properties.
Values
- <percentage>
- Scales the background image in the desired dimension to the specified percentage of the background positioning area, which is determined by the value of
background-origin
. The background positioning area is, by default, the area containing the content of the box and its padding; the area may also be changed to just the content or to the area containing borders, padding, and content. If the background's
attachment
is fixed
, the background positioning area is instead the entire area of the browser window, not including the area covered by scrollbars if they are present. - <length>
- Scales the background image to the specified length in the desired dimension.
- auto
- Scales the background image in the relevant direction such that its intrinsic proportion is maintained.
The first value determines how the image is scaled horizontally, the second how it is scaled vertically. If only one value is specified, the second value is implicitly auto
. Negative sizes are not allowed.
- contain
- Specifies that the background image should be scaled to be as large as possible while ensuring both its dimensions are less than or equal to the corresponding dimensions of the background positioning area.
- cover
- Specifies that the background image should be scaled to be as small as possible while ensuring both its dimensions are greater than or equal to the corresponding dimensions of the background positioning area.
Interpretation of possible values depends on the image's intrinsic dimensions (width and height) and intrinsic proportion (ratio of width and height). A bitmap image always has intrinsic dimensions and an intrinsic proportion. A vector image may have both intrinsic dimensions (and thus must have an intrinsic proportion). It also may have one or no intrinsic dimension, and in either case it might or might not have an intrinsic proportion. Gradients are treated as images with no intrinsic dimensions or intrinsic proportion.
Gecko 8.0 note
(Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5)
This behavior changed in Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5)
. Before this, gradients were treated as images with no intrinsic dimensions, with an intrinsic proportion identical to that of the background positioning area.
Background images generated from elements using
-moz-element
(which actually match an element) are currently treated as images with the dimensions of the element, or of the background positioning area if the element is SVG, with the corresponding intrinsic proportion.
Note: This is not the currently-specified behavior, which is that the intrinsic dimensions and proportion should be those of the element in all cases.
The rendered size of the background image is then computed as follows:
- If both components of
background-size
are specified and are not auto
: - The background image renders at the specified size.
- If the
background-size
is contain
or cover
: - The image is rendered, preserving its intrinsic proportion, at the largest size contained within, or covering, the background positioning area. If the image has no intrinsic proportion, then it is rendered at the size of the background positioning area.
- If the
background-size
is auto
or auto auto
: - If the image has both intrinsic dimensions, it is rendered at that size. If it has no intrinsic dimensions and no intrinsic proportion, it is rendered at the size of the background positioning area. If it has no dimensions but has a proportion, it's rendered as if
contain
had been specified instead. If the image has one intrinsic dimension and a proportion, it's rendered at the size determined by that one dimension and the proportion. If the image has one intrinsic dimension but no proportion, it's rendered using the intrinsic dimension and the corresponding dimension of the background positioning area. - If the background-size has one
auto
component and one non-auto
component: - If the image has an intrinsic proportion, then render it using the specified dimension, and compute the other dimension from the specified dimension and the intrinsic proportion. If the image has no intrinsic proportion, use the specified dimension for that dimension. For the other dimension, use the image's corresponding intrinsic dimension if there is one. If there is no such intrinsic dimension, use the corresponding dimension of the background positioning area.
Note that background sizing for vector images that lack intrinsic dimensions or proportion is not yet fully implemented in all browsers. Be careful about relying on the behavior described above, and test in multiple browsers (specifically including versions of Firefox 7 or earlier and Firefox 8 or greater) to be sure different renderings are acceptable.
Notes
While this property is new in Gecko 1.9.2 (Firefox 3.6), it is possible to stretch a image fully over the background in Firefox 3.5 by using
-moz-border-image
.
.foo {
background-image: url(bg-image.png);
-moz-background-size: 100% 100%; /* Gecko 1.9.2 (Firefox 3.6) */
-o-background-size: 100% 100%; /* Opera 9.5 */
-webkit-background-size: 100% 100%; /* Safari 3.0 */
background-size: 100% 100%; /* Gecko 2.0 (Firefox 4.0) and other CSS3-compliant browsers */
-moz-border-image: url(bg-image.png) 0; /* Gecko 1.9.1 (Firefox 3.5) */
}
If you are specifying a gradient as background and have specified a background-size
to go with it, it's best not to specify a size that uses a single auto component, or is specified using only a width value (for example, background-size: 50%
). Rendering of gradients in such cases changed in Firefox 8, and at present it is generally inconsistent across browsers, which do not all implement rendering in full accordance with the CSS3 background-size
specification and with the CSS3 Image Values gradient specification.
.bar {
width: 50px; height: 100px;
background-image: gradient(...);
/* NOT RECOMMENDED */
background-size: 25px;
background-size: 50%;
background-size: auto 50px;
background-size: auto 50%;
/* OKAY */
background-size: 25px 50px;
background-size: 50% 50%;
}
Note that it's particularly not recommended to use a pixel dimension and an auto
dimension with a gradient, because it's impossible to replicate rendering in versions of Firefox prior to 8, and in browsers not implementing Firefox 8's rendering, without knowing the exact size of the element whose background is being specified.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0
-webkit
| 3.6 (1.9.2)
-moz
| 9.0 | 9.5
-o with some bugs (see below) | 3.0 (522)
-webkit but from an older CSS3 draft (see below) |
3.0 | 4.0 (2.0)
| 10.0 |
Support for
contain | cover
| 3.0 | 3.6 (1.9.2)
| 9.0 | 10.0 | 4.1 (532) |
Support for SVG backgrounds | ? | 8.0 (8.0)
| ? | ? | ? |
Feature | Android | Firefox Mobile (Gecko) | Windows Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
Support for SVG backgrounds | ? | 8.0 (8.0)
| ? | ? | ? |
- As of July 2009, Opera 9.5's computation of the background positioning area is incorrect for fixed backgrounds. Opera 9.5 also interprets the two-value form as a horizontal scaling factor and, from appearances, a vertical clipping dimension.
- WebKit-based browsers as of July 2009 implement an older draft of CSS3
background-size
in which an omitted second value is treated as duplicating the first value; this draft does not include the contain
or cover
keywords. - Konqueror 3.5.4 supports
-khtml-background-size
. -
-moz-background-size
is no longer supported in Gecko 2.0; you must use background-size
instead. - See Scaling of SVG backgrounds for details on how SVG images are scaled when used for
background-size
.
« CSS « CSS Reference
Summary
The border-bottom-color
CSS property sets the color of the bottom border of an element.
See
border-top-color
for more and detailed information.
« CSS « CSS Reference
Syntax
border-bottom: [ <border-width> || <border-style> || <border-color> ] | inherit
Notes
The three values of the shorthand property can be specified in any order, and one or two of them may be omitted.
As with all shorthand properties, border-bottom
always sets the values of all of the properties that it can set, even if they are not specified. It sets those that are not specified to their default values. This means that:
border-bottom-style: dotted;
border-bottom: thick green;
is actually the same as
border-bottom-style: dotted;
border-bottom: none thick green;
and the value of
border-bottom-style
given before border-bottom
is ignored.
Since the default value of
border-bottom-style
is none
, not specifying the <border-style> part of the value means that the property specifies no border.
Browser compatibility
Browser | Lowest Version |
Chrome | 1.0 |
Firefox | 1 |
Internet Explorer | 4 |
Netscape | 4 |
Opera | 3.5 |
« CSS « CSS Reference
Summary
The CSS property border-bottom-left-radius
sets the rounding of the bottom-left corner of the border. Previous to Gecko 2.0 (Firefox 4.0) this was named -moz-border-radius-bottomleft.
See the border-top-left-radius
and border-radius
properties for more information.
« CSS « CSS Reference
Summary
The CSS property border-bottom-right-radius
sets the rounding of the bottom-right corner of the border. Previous to Gecko 2.0 (Firefox 4.0) this was named -moz-border-radius-bottomright.
See the
border-top-left-radius
and
border-radius
properties for more information.
« CSS « CSS Reference
Summary
border-bottom-style
sets the line style of the bottom border of a box.
Syntax
border-bottom-style: <border-style> | inherit
<border-style> Values
- none
- No border.
- hidden
- Same as 'none', except in terms of border conflict resolution for table elements.
- dotted
- Series of dots.
- dashed
- Series of short dashes or line segments.
- solid
- Single, straight, solid line.
- double
- Two straight lines that add up to the pixel amount defined as
border-width
. - groove
- Carved effect.
- ridge
- Opposite of 'groove'. The border appears 3D (coming out).
- inset
- Makes the box appear embedded.
- outset
- Opposite of 'inset'. Makes the box appear 3D (embossed).
Examples
View Live Examples
element {
border-bottom-size: 1px;
border-bottom-style: dotted;
border-bottom-color: #000;
}
Notes
Unless a border-style value is set, your border will not appear because the default value is set to 'none.'
Browser Compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | 1.0 | 1.0 | 5.5 | 9.2 | 1.0 |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
border-bottom-width
sets the width of the bottom border of a box.
Syntax
border-bottom-width: <border-width> | inherit
<border-width> Values
- thin
- A thin border.
- medium
- A medium border.
- thick
- A thick border.
- <length>
- The border's thickness has an explicit value. Explicit border widths cannot be negative.
Note: An em
value is also supported.
Examples
View Live Examples
element {
border-bottom-width: thin;
border-bottom-style: solid;
border-bottom-color: #000;
}
Browser Compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 4.0 | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The border-collapse
CSS property selects a table's border model. This has a big influence on the look and style of the table cells.
The separated model is the traditional HTML table border model. Adjacent cells each have their own distinct borders. The distance between them given by the
border-spacing
property.
In the collapsed border model, adjacent table cells share borders.
Syntax
border-collapse: collapse | separate | inherit
Values
- separate
- Default, use the "separated borders" rendering model
- collapse
- Use the "collapsed borders" rendering model
Examples
View Live Examples
th, td { border: solid 1px red; }
table { border-collapse: collapse; }
<table border=6>
Browser | Layout Engine |
Internet Explorer | Trident |
Firefox | Gecko |
Opera | Presto |
Safari | WebKit |
<table border=6 style=
"border-collapse:collapse">
Browser | Layout Engine |
Internet Explorer | Trident |
Firefox | Gecko |
Opera | Presto |
Safari | WebKit |
Notes
In the "collapsed border" rendering model, the
border-style
value of inset
behaves like groove
, and outset
behaves like ridge
.
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 1.0 (1.7 or earlier)
| 1.0 | 5.0 | 4.0 | 1.2 (125) |
Feature | Firefox Mobile (Gecko) | Android | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 1.0 (1.9.2)
| ? | ? | ? | ? |
« CSS « CSS Reference
Syntax
border-color: [ <color> || transparent ]{1,4} | inherit
Values
Accepts one, two, tree or four values.
- <color>
- See
<color>
value for possible keywords and units. - transparent
- The border is not drawn but it still takes up space on the page.
If one color value is given, it applies to all four borders.
Two values apply first to the top and bottom border and second to the left and right border.
Three values apply first to the top, second to the left and right and third to the bottom border.
Four values apply to top, right, bottom and left border in that order.
Examples
View Live Examples
pre {
border-style: ridge dashed solid;
border-color: orange blue;
}
Notes
In order to see the border you must at least set the
border-style
to something visible.
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 1.0 (1.7 or earlier)
| 1.0 | 4.0 | 3.5 | 1.0 (85) |
Feature | Firefox Mobile (Gecko) | Android | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 1.0 (1.9.2)
| ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The border
property is a shorthand property for setting the individual border property values in a single place in the style sheet. border
can be used to set the values for one or more of:
border-width
,
border-style
,
border-color
.
Syntax
border: [ <border-width> || <border-style> || <border-color> ] | inherit
Values
- border-width
-
Optional, default value
medium
is used if absent. See
border-width
. - border-style
-
Required, default value
none
is used if absent. See
border-style
. - border-color
-
Optional, default value if absent: The value of the element's
color
property (foreground color). See
border-color
.
Examples
View Live Examples
element { border: dashed } /* dashed border of medium thickness, the same color as the text */
element { border: dotted 1.5em } /* dotted, 1.5em thick border, the same color as the text */
element { border: solid red } /* solid, red border of medium thickness */
element { border: solid blue 10px } /* solid, blue border of 10px thickness */
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 1.0 (1.7 or earlier)
| 1.0 | 4.0 | 3.5 | 1.0 (85) [1]
|
Feature | Firefox Mobile (Gecko) | Android | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 1.0 (1.9.2)
| ? | ? | ? | 1.0 [2]
|
Summary
The border-image
CSS property allows drawing an image on the borders of elements. This makes drawing complex looking widgets much simpler than it has been and removes the need for nine boxes in some cases.
Warning: The official CSS 3 specification for the border-image property changed significantly between the time this feature was frozen for Gecko 1.9.1 and its release. As such, both the syntax and semantics of this feature will probably change in future releases of Gecko. In particular, the optional border-width
override has been removed from the specification and will almost certainly be removed in a future version of Gecko.
The border-image
is used instead of the border styles given by the
border-style
properties. If the value is none
or if the image cannot be displayed, the border styles will be used. An additional background image for the element is drawn on top of the
background-image
.
Syntax
none |
[ <image> [ <number> | <percentage> ]{1,4} [/ <border-width>{1,4}]? ] && [ stretch | repeat | round ]{0,2}
Values
- none
- No image displayed, other border styles are used.
- <image> (required)
- The image value is a
<uri>
, e.g. url(http://example.org/image.png)
- <number> | <percentage> (required)
- One, two, three or four values represent inward offsets from the top, right, bottom, and left edges of the image (respectively), dividing it into nine regions: four corners, four edges and a middle.

One value belongs to all four sides of the image.
Two values belong 1. to top and bottom and 2. to right and left side.
Three values belong 1. to top, 2. to the right and left side and 3. to bottom.
Four values belong to the top, right, bottom and left edge of the image in that order.
In Gecko 1.9.1 (Firefox 3.5) the middle part of the image is drawn like a background-image of the element. This may change in future versions.
Percentages are relative to the width/height of the image.
Numbers represent pixels in the image (if the image is a raster image) or vector coordinates (if the image is an SVG image). - <border-width> (optional)
- If the slash / is present in the property value, the one, two, three or four values after it are used for the width of the border instead of the
border-width
properties. The order of the values is the same as for
border-width
. - stretch | round | repeat (optional)
- One or two keywords, that specify how the images for the sides and the middle part are scaled and tiled.
stretch
(default value) will cause images to be scaled to fit their box.
round
will tile the images, but also scale them so that a whole number fit in the box.
repeat
simply tiles the images inside the box.
The first keyword describes how to draw the top, middle, and bottom images, while the second describes the left and right borders. If the second is absent, it is assumed to be the same as the first. If both are absent, the default value stretch
is used.
Examples
[needs some instructive live examples]
#header { -moz-border-image: url(border.png) 27 27 27 27 round round; }
.button { -moz-border-image: url(button.png) 0 5 0 5; }
.example { -moz-border-image: url(example.jpg) 3 4 6 8 / 10px 12px 14px 22px; }
/* Edge case, acts like a full scaled background-image in Firefox 3.5 */
div { -moz-border-image: url(bgimage.png) 0; }
Browser compatibility
Note: Features beyond basic support are not yet documented in above sections. Please read the spec if you are interested.
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 3.5 (1.9.1)
-moz
| 7.0
-webkit
| -- | 10.5 / 11.0
-o
| 3.0
-webkit
|
optional <border-image-slice>
|
-- Unimplemented (see
bug 497995
)
| ? | -- | ? | ? |
fill keyword | -- | ? | -- | ? | ? |
Feature | iOS Safari | Opera Mini | Opera Mobile | Android Browser |
Basic support | 3.2
-webkit
| -- | 11.0
-o
| 2.1
-webkit
|
optional <border-image-slice>
| ? | -- | ? | ? |
fill keyword | ? | -- | ? | ? |
Notes
- Unusually, for Opera, the prefixed property was added after the non-prefixed.
« CSS « CSS Reference
Summary
The border-left-color
CSS property sets the color of the left border of an element.
See
border-top-color
for more and detailed information.
« CSS « CSS Reference
Summary
The border-left
is a shorthand property for setting the width, style and color of left border of a box. This property can be used to set the values for one or more of:
border-left-width
,
border-left-style
,
border-left-color
. Omitted values are set to their initial values.
Syntax
border-left: [border-width || border-style || border-color | inherit] ;
Examples
element {
border-left: 1px solid #000;
}
Notes
If the rule does not specify a border color, the border will have the color specified by the
color
property.
Browser compatibility
Browser | Lowest Version |
Chrome | 1.0 |
Firefox | 1 |
Internet Explorer | 4 |
Netscape | 4 |
Opera | 3.5 |
« CSS « CSS Reference
Summary
border-left-style
sets the line style of the left border of a box.
See the
border-bottom-style
property for more information.
« CSS « CSS Reference
Summary
border-left-width
sets the width of the left border of a box.
See the border-bottom-width property for more information.
« CSS « CSS Reference
Syntax
border-radius: <border-radius>{1,4} [ / <border-radius>{1,4}]?
Values
Accepts one, two, three or four <border-radius>
values, optional followed by a slash /
and a second set of values. <border-radius>
represents one of:
- <length>
- See
<length>
for possible units. - <percentage>
- Percentages for the horizontal radius are relative to the width of the border box, whereas percentages for the vertical radius are relative to the height of the border box.
If one value is set, this radius applies to all 4 corners.
If two values are set, the first applies to top-left
and bottom-right
corner, the second applies to top-right
and bottom-left
corner.
Four values apply to the top-left
, top-right
, bottom-right
, bottom-left
corner in that order.
Three values: The second value applies to top-right
and also bottom-left
.
If the slash followed by a second set of radii is specified, the values before the slash are used to specify the horizontal radius, while the values after the slash specify the vertical radius. If the slash is omitted, then the same values are used to set both horizontal and vertical radii.
For example:
border-radius: 1em/5em;
/* is equivalent to */
border-top-left-radius: 1em 5em;
border-top-right-radius: 1em 5em;
border-bottom-right-radius: 1em 5em;
border-bottom-left-radius: 1em 5em;
border-radius: 4px 3px 6px / 2px 4px;
/* is equivalent to: */
border-top-left-radius: 4px 2px;
border-top-right-radius: 3px 4px;
border-bottom-right-radius: 6px 2px;
border-bottom-left-radius: 3px 4px;
Examples
border: solid 10px;
/* the border will curve into a 'D' */
border-radius: 0 50px 50px 0;
border: groove 1em red;
border-radius: 2em;
background: gold;
border: ridge gold;
border-radius: 13em/3em;
background: gold;
border-radius: 40px 10px;
background: black;
color: gray;
border-radius: 50%;
Notes
- Dotted and dashed rounded border corners are rendered as solid in Gecko; see
bug 382721
.
-
border-radius
does not apply to table elements when
border-collapse
is collapse
. - Old WebKit handles multiple values different, see below.
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 4.0 (2.0)
1.0 (1.7 or earlier)
-moz
| 4.0 0.2
-webkit
| 9.0 | 10.5 | 5.0 3.0
-webkit
|
Elliptical borders | 3.5 (1.9.1)
| yes | yes | yes | yes, but see below |
4 values for 4 corners | yes | 4.0 | yes | yes | 5.0 |
Percentages | yes was Non-standard (see below) | yes | yes | 11.5 | 5.1 |
Feature | iOS Safari | Opera Mini | Opera Mobile | Android Browser |
Basic support | 3.2
-webkit
| -- | -- | 2.1
-webkit
|
Elliptical borders | ? | -- | -- | ? |
4 values for 4 corners | ? | -- | -- | ? |
Percentages | ? | -- | -- | ? |
<percentage>
values
- are not supported in older Chrome and Safari versions (it was fixed in Sepember 2010)
- are buggy in Opera prior to 11.50
- are implemented in a non-standard way prior to Gecko 2.0 (Firefox 4). Both horizontal and vertical radii were relative to the width of the border box.
Notes
Older Safari and Chrome versions (prior to WebKit 532.5)
In Gecko 2.0 -moz-border-radius
is renamed to border-radius
. -moz-border-radius
is supported as an alias for a transitional period (at least until the next version of Gecko). In order to conform to the CSS3 standard, Gecko 2.0
- changes the handling of
<percentage>
values to match the specification. You can specify an ellipse as border on an arbitrary sized element just with border-radius: 50%;
- makes rounded corners clip content and images (if
overflow
: visible
is not set)
In Opera (prior to Opera 12), applying border-radius
to replaced elements will not have rounded corners.
« CSS « CSS Reference
Summary
border-right-color
sets the color of the right border of an element.
See the
border-top-color
property for more information.
« CSS « CSS Reference
Summary
The border-right
is a shorthand property for setting the width, style and color of right border of a box. This property can be used to set the values for one or more of:
border-right-width
,
border-right-style
,
border-right-color
. Omitted values are set to their initial values.
Syntax
border-right: [border-width || border-style || border-color | inherit] ;
Examples
element {
border-right: 1px solid #000;
}
Notes
If the rule does not specify a border color, the border will have the color specified by the
color
property.
Browser compatibility
« CSS « CSS Reference
Summary
border-right-style
sets the line style of the right border of a box.
See the
border-bottom-style
property for more information.
« CSS « CSS Reference
Summary
border-right-width
sets the width of the right border of a box.
See the border-bottom-width property for more information.
« CSS « CSS Reference
Summary
The border-spacing
CSS property specifies the distance between the borders of adjacent cells (only for the separated borders model). This is equivalent to the cellspacing attribute in presentational HTML, but an optional second value can be used to set different horizontal and vertical spacing.
-
Initial value
: 0
Note: In desktop browsers like Firefox the default value for HTML tables is 2px
. - Applies to: tables and inline-tables
-
Inherited
: Yes
- Percentages: n/a
- Media:
visual
-
Computed value
: two absolute lengths
Syntax
border-spacing: <length> <length>? | inherit
Values
Accepts one or two values.
- <length>
- A single value is for both horizontal and vertical border spacing. See
<length>
for possible units. - <length> <length>
- The first
<length>
gives the horizontal spacing (space between cells in adjacent columns) and the second length gives the vertical spacing (space between cells in adjacent rows).
Notes
- This property applies only when
border-collapse
is separate
. - The border-spacing is also used along the outside edge of the table, where the distance between the table's border and the cells in the first/last column or row is the sum of the relevant (horizontal or vertical) border-spacing and the relevant (top, right, bottom, or left) padding on the table.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.7 or earlier)
| 8.0 | 4.0 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | 1.0 (1.9.2)
| ? | ? | ? |
« CSS « CSS Reference
Summary
The border-style
CSS property is a shorthand property for setting the line style for all four sides of the elements border.
Syntax
border-style: [ <border-style> ]{1,4} | inherit
Values
- <border-style>
- The Border Style can be any of the following values.
-
none : No border, sets width to 0. This is the default value.
-
hidden : Same as 'none', except in terms of border conflict resolution for table elements.
-
dashed : Series of short dashes or line segments.
-
dotted : Series of dots.
-
double : Two straight lines that add up to the pixel amount defined as
border-width
. -
groove : Carved effect.
-
inset : Makes the box appear embedded.
-
outset : Opposite of 'inset'. Makes the box appear 3D (embossed).
-
ridge : Opposite of 'groove'. The border appears 3D (coming out).
-
solid : Single, straight, solid line.
Up to four values can be given;
The first value sets all four borders.
The second sets the left and right.
The third sets the bottom.
The fourth sets the left.
Examples
View Live Examples
element {
border-width: 1px;
border-style: solid;
border-color: black;
}
Notes
The default value of border-style
is none
. This meant that if you change the
border-width
and the
border-color
you will not see the border unless you change this property to something other than none
or hidden
.
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 1.0 (1.7 or earlier)
| 1.0 | 4.0 | 3.5 | 1.0 |
Feature | Firefox Mobile (Gecko) | Android | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 1.0 (1.9.2)
| ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The border-top-color
CSS property sets the color of the bottom border of an element. Note that in many cases the shortcut
border-color
is more convenient and preferable.
Syntax
border-top-color: <color> | transparent | inherit
Values
- <color>
- See
<color>
values for the various possible keywords and numerical notations. - transparent
- The element has no color of its own, instead showing the color of the element behind it.
Examples
View Live Examples
pre {
border: ridge 1em gold;
border-top-color: red;
}
/* this has the same result:
border: ridge 1em;
border-color: red gold gold; */
Browser Compatibility
Browser | Lowest Version |
Chrome | 1.0 |
Firefox (Gecko) | 1.0 (1.0) |
Internet Explorer | 4.0 |
Opera | 3.5 |
Safari (WebKit) | 1.0 (85) |
Mozilla Extensions
-moz-border-top-colors
sets the top border to multiple colors for Gecko based browsers like Firefox.
« CSS « CSS Reference
Summary
The border-top
is a shorthand property for setting the width, style and color of top border of a box. This property can be used to set the values for one or more of:
border-top-width
,
border-top-style
,
border-top-color
. Omitted values are set to their initial values.
Syntax
border-top: [border-width || border-style || border-color | inherit] ;
Examples
element {
border-top: 1px solid #000;
}
Notes
If the rule does not specify a border color, the border will have the color specified by the
color
property.
Browser compatibility
« CSS « CSS Reference
Summary
The border-top-left-radius
CSS property sets the rounding of the top-left corner of the element.
Previous to Gecko 2.0 (Firefox 4.0) it was named -moz-border-radius-topleft
. This is supported as an alias for a short transitional period.
See
border-radius
for more information.
Syntax
-moz-border-radius-topleft: <border-radius> <border-radius>?
border-top-left-radius: <border-radius> <border-radius>?
Values
Accepts one <border-radius>
value.
New in Firefox 3.5
An optional second value for elliptical corners. The two values define the radii of a quarter ellipse that defines the shape of the corner. The first value is the horizontal radius. The optional second value is the vertical radius, if omitted it's equal to the first.
<border-radius>
represents one of:
- <length>
- See
<length>
for possible units. - <percentage>
-
Since Gecko 2.0 (Firefox 4.0): Percentages for the horizontal radius refer to the width of the box, whereas percentages for the vertical radius refer to the height of the box.
In previous Gecko/Firefox versions Non-standard : Relative to the width of the box (the percentage is relative to the width even when specifying the radius for a height).
Examples
div { -moz-border-radius-topleft: 20px; /* Firefox up to version 3.6 */
-webkit-border-top-left-radius: 20px; /* Safari, Chrome (before WebKit version 533) */
border-top-left-radius: 20px; /* Firefox 4; browsers with CSS3 support */
}
/* elliptical corners supported since Firefox 3.5 (Gecko 1.9.1) */
div { -moz-border-radius-topleft: 20px; /* round corner, fallback for Firefox 1-3.0 */
-moz-border-radius-topleft: 20px 10px; /* elliptical border, Firefox 3.5-3.6 */
-webkit-border-top-left-radius: 20px 10px; /* Safari, Chrome (before WebKit version 532.5) */
border-top-left-radius: 20px 10px; /* Firefox 4; browsers with CSS3 support */
}
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 0.2 | -webkit-border-top-left-radius -webkit-border-top-right-radius -webkit-border-bottom-right-radius -webkit-border-bottom-left-radius | 1.0 (1.0) | -moz-border-radius-topleft -moz-border-radius-topright -moz-border-radius-bottomright -moz-border-radius-bottomleft | 9.0 | border-top-left-radius border-top-right-radius border-bottom-right-radius border-bottom-left-radius | 10.5 | border-top-left-radius border-top-right-radius border-bottom-right-radius border-bottom-left-radius | 3.0 (522) | -webkit-border-top-left-radius -webkit-border-top-right-radius -webkit-border-bottom-right-radius -webkit-border-bottom-left-radius |
4.0 |
border-top-left-radius border-top-right-radius border-bottom-right-radius
border-bottom-left-radius | 4.0 (2.0) | border-top-left-radius border-top-right-radius border-bottom-right-radius border-bottom-left-radius | 5.0 (532.5) | border-top-left-radius border-top-right-radius border-bottom-right-radius border-bottom-left-radius |
Percentages | 4.0 | 1.0 (1.0) Non-standard | 9.0 | 10.5 | 5.0 (532.5) |
4.0 (2.0) |
Elliptical corners | 0.2 | 3.5 (1.9.1) | 9.0 | 10.5 | 3.0 (522 ) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The CSS property border-top-right-radius
sets the rounding of the top-right corner of the border. Previous to Gecko 2.0 (Firefox 4.0) this was named -moz-border-radius-topright.
See the border-top-left-radius
and border-radius
properties for more information.
« CSS « CSS Reference
Summary
border-top-style
sets the line style of the top border of a box.
See the
border-bottom-style
property for more information.
« CSS « CSS Reference
Summary
border-top-width
sets the width of the top border of a box.
See the border-bottom-width property for more information.
« CSS « CSS Reference
Summary
The border-width
CSS property sets the width of the border of a box. Using the shortcut property
border
is often more convenient.
Syntax
border-width: <border-width> {1,4}
Values
Accepts one, two, three or four <border-width>
values. These whitespace separated values set the width of the top, right, bottom, and left border of a box.
If one value is set, this width applies to all 4 sides.
If two values are set, the first applies to top and bottom, the second applies to the right and left side.
Three values apply to the top, right and bottom side. The left side takes the second value.
Four values apply to the top, right, bottom, left side in that order.
- <border-width>
- is one value or keyword of:
<length>
| thin | medium | thick
- thin
- Depends on the UA. Typically 1px in desktop browsers like Firefox and IE 8. 2px in IE 4-7.
- medium
- Depends on the UA. Typically 3px in desktop browsers like Firefox and IE 8. 4px in IE 4-7.
- thick
- Depends on the UA. Typically 5px in desktop browsers like Firefox and IE 8. 6px in IE 4-7.
- <length>
- The border's thickness has an explicit value. Cannot be negative. See
<length>
for possible units.
Examples
border: ridge #ccc;
border-width: 6px; /* same as "border: ridge #ccc 6px"; 6px wide border on all 4 sides */
border: solid red;
border-width: 2px 10px; /* 2px wide top and bottom border, 10px right and left border */
border: dotted orange;
border-width: 0.3em 0; /* 0.3em wide top and bottom border, no border right and left */
border: solid lightgreen;
border-width: medium 0 1px thick; /* three different width, no right border */
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 1.0 (1.7 or earlier)
| 1.0 | 4.0 | 3.5 | 1.0 (85) |
Feature | Firefox Mobile (Gecko) | Android | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 1.0 (1.9.2)
| ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The bottom
property specifies part of the position of positioned elements.
For absolutely positioned elements (those with position: absolute
or position: fixed
), it specifies the distance between the bottom margin edge of the element and the bottom edge of its containing block.
For relatively positioned elements (those with position: relative
), it specifies the amount the element is moved above its normal position. However, the
top
property overrides the bottom property, so if top
is not auto
, the computed value of bottom
is the negative of the computed value of top
.
Syntax
bottom: <length> | <percentage> | auto | inherit
Values
- <length>
- A length, used as described in the summary. Can be negative, zero, or positive.
- <percentage>
- A percentage of the containing block's height, used as described in the summary.
-
auto
- For absolutely positioned elements, position the element based on the
top
property and treat height: auto
as a height based on the content. For relatively positioned elements, offset the element from its original position based on the
top
property, or if top
is also auto
, do not offset it at all. -
inherit
- Inherits the computed value from its parent element (which may not be its containing block). This computed value is then handled like it was a <length>, a <percentage>, or
auto
Examples
element {
position: absolute;
bottom: 20px;
height: 200px;
border: 1px solid #000;
}
The following sample page contrasts position:absolute
and position:fixed
. When the regular text becomes taller than the viewable portion of the page (the browser window's viewport), blocks positioned with position:absolute
will scroll with the page, while blocks positioned with position:fixed
will not. Note that IE6 does not support position:fixed
.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>Position at bottom, absolute or fixed</title>
<style type="text/css">
p {font-size:30px; line-height:3em;}
div.pos {width:49%; text-align:center; border:2px solid #00f;}
div#abs {position:absolute; bottom:0; left:0;}
div#fix {position:fixed; bottom:0; right:0;}
</style>
</head>
<body>
<p>This<br>is<br>some<br>tall,<br>tall,
<br>tall,<br>tall,<br>tall<br>content.</p>
<div id="fix" class="pos"><p>Fixed</p></div>
<div id="abs" class="pos"><p>Absolute</p></div>
</body>
</html>
Notes
For absolutely positioned elements whose containing block is based on a block-level element, this property is an offset from the padding edge of that element.
For absolutely positioned elements, the bottom
property has no visible effect when all of
top
,
height
, and
margin-top
are not auto
(which is the default value for top
and height
).
Browser Compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.7 or earlier)
| 5 | 6 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | 1.0 (1.9.2)
| ? | ? | ? |
« CSS « CSS Reference
Summary
The box-shadow
CSS property accepts one or more shadow effects as a comma-separated list. It allows casting a drop shadow from the frame of almost any element. If a
border-radius
is specified on the element with a box shadow, the box shadow takes on the same rounded corners. The z-ordering of multiple box shadows is the same as multiple text shadows (the first specified shadow is on top).
Syntax
box-shadow: none | <shadow> [,<shadow>]*
where <shadow> is defined as:
inset? && [ <offset-x> <offset-y> <blur-radius>? <spread-radius>? <color>? ]
Values
- inset (optional)
- If not specified (default), the shadow is assumed to be a drop shadow (as if the box were raised above the content).
The presence of the inset
keyword changes the shadow to one inside the frame (as if the content was depressed inside the box). Inset shadows are drawn above background, but below border and content. - <offset-x> <offset-y> (required)
- This are two
<length>
values to set the shadow offset. <offset-x>
specifies the horizontal distance. Negative values place the shadow to the left of the element. <offset-y>
specifies the vertical distance. Negative values place the shadow above the element. See
<length>
for possible units.
If both values are 0
, the shadow is placed behind the element (and may generate a blur effect if <blur-radius>
and/or <spread-radius>
is set). - <blur-radius> (optional)
- This is a third
<length>
value. The larger this value, the bigger the blur, so the shadow becomes bigger and lighter. Negative values are not allowed. If not specified, it will be 0
(the shadow's edge is sharp). - <spread-radius> (optional)
- This is a fourth
<length>
value. Positive values will cause the shadow to expand and grow bigger, negative values will cause the shadow to shrink. If not specified, it will be 0
(the shadow will be the same size as the element). - <color> (optional)
- See
<color>
values for possible keywords and notations.
If not specified, the color depends on the browser. In Gecko (Firefox), Presto (Opera) and Trident (Internet Explorer), the value of the
color
property is used. On the other hand, WebKit's shadow is transparent and therefore useless if <color>
is omitted.
Live examples
-moz-box-shadow: 60px -16px teal;
-webkit-box-shadow: 60px -16px teal;
box-shadow: 60px -16px teal;
-moz-box-shadow: 10px 5px 5px black;
-webkit-box-shadow: 10px 5px 5px black;
box-shadow: 10px 5px 5px black;
-moz-box-shadow: 3px 3px red, -1em 0 0.4em olive;
-webkit-box-shadow: 3px 3px red, -1em 0 0.4em olive;
box-shadow: 3px 3px red, -1em 0 0.4em olive;
-moz-box-shadow: inset 5em 1em gold;
-webkit-box-shadow: inset 5em 1em gold;
box-shadow: inset 5em 1em gold;
-moz-box-shadow: 0 0 1em gold;
-webkit-box-shadow: 0 0 1em gold;
box-shadow: 0 0 1em gold;
-moz-box-shadow: inset 0 0 1em gold;
-webkit-box-shadow: inset 0 0 1em gold;
box-shadow: inset 0 0 1em gold;
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | 10.0 1.0
-webkit
| 4.0 (2.0)
3.5 (1.9.1)
-moz
| 9.0 | 10.5 | 5.1 (WebKit 534) 3.0 (WebKit 522)
-webkit
|
Multiple shadows | 10.0 1.0
-webkit
| 4.0 (2.0)
3.5 (1.9.1)
-moz
| 9.0 | 10.5 | 5.1 (WebKit 534) 3.0 (WebKit 522)
-webkit
|
inset keyword | 10.0 4.0
-webkit
| 4.0 (2.0)
3.5 (1.9.1)
-moz
| 9.0 | 10.5 | 5.1 (WebKit 534) 5.0 (WebKit 533)
-webkit
|
Spread radius | 10.0 4.0
-webkit
| 4.0 (2.0)
3.5 (1.9.1)
-moz
| 9.0 | 10.5 | 5.1 (WebKit 534) 5.0 (WebKit 533)
-webkit
|
Feature | iOS Safari | Opera Mini | Opera Mobile | Android Browser |
Basic support | ? | ? | ? | ? |
Multiple shadows | ? | ? | ? | ? |
inset keyword | ? | ? | ? | ? |
Spread radius | ? | ? | ? | ? |
Notes
- Since version 5.5, Internet Explorer supports Microsoft's DropShadow and Shadow Filter. You can use this proprietary extension to cast a drop shadow (though the syntax and the effect are different from CSS3).
- Shadows affect layout in older Gecko, Presto, and WebKit; e.g. if you cast an outer shadow to a box with a
width
of 100%
, you'll see a scrollbar.
« CSS « CSS Reference
Summary
The box-sizing
CSS property is used to alter the default CSS box model used to calculate widths and heights of elements. It is possible to use this property to emulate the behavior of browsers that do not correctly support the CSS box model specification. Mozilla browsers like Firefox support -moz-box-sizing
.
Syntax
box-sizing: content-box | border-box
-moz-box-sizing: content-box | border-box | padding-box
Values
- content-box
- This is the default style as specified by the CSS standard. The
width
and height
properties are measured including only the content, but not the border, margin, or padding. - padding-box
- The
width
and height
properties include the padding size, and do not include the border or margin.
Non-standard padding-box
isn't part of CSS3-UI and only supported by Firefox (Gecko). - border-box
- The
width
and height
properties include the padding and border, but not the margin. This is the box model used by Internet Explorer when the document is not in standards-compliant mode.
Examples
/* support Firefox, Safari/WebKit, Opera and IE8 */
.example {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
Notes
See
bug 243412
and its dependents:
-
-moz-box-sizing
doesn't apply to table cells -
min-height/max-height
does not work for -moz-box-sizing: border-box
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0
-webkit-box-sizing
box-sizing
|
1.0 (1.0)
-moz-box-sizing
| 8.0
box-sizing
| 7.0
box-sizing
|
3.0 (522)
-webkit-box-sizing
box-sizing
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The caption-side
property positions the content of table-caption at the specified side.
Syntax
caption-side: top | bottom | left | right | inherit
Values
- top
- caption box will be above the table.
- bottom
- caption box will be below the table.
- left
- caption box will be on the left side of the table. This Value is dropped from CSS 2.1 but supported in Gecko (Firefox).
- right
- caption box will be on the right side of the table. This Value is dropped from CSS 2.1 but supported in Gecko (Firefox).
Browser Compatibility
Feature | Chrome | Firefox | Internet Explorer | Opera | Safari |
Basic support | 1.0 | 1.0 | 8.0 | 4.0 | 1.0 |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The clear property specifies whether an element can be next to floating elements that precede it or must be moved down (cleared) below them.
Syntax
clear: none | left | right | both | inherit
Values
- none
- Element is not moved down to clear past floating elements.
- left
- Element is moved down to clear past left floats.
- right
- Element is moved down to clear past right floats.
- both
- Element is moved down to clear past both left and right floats.
Examples
View Live Examples
h1 { clear: none }
h2 { clear: right }
If you want an element to contain all floating elements inside it, you can either float the container as well, or use clear
#container:after { content: "."; line-height: 0; height: 0; display: block; visibility: hidden; clear: both; }
Notes
The clear property applies to both floating and non-floating elements.
When it applies to non-floating blocks, it moves the border edge of the element down until it is below the margin edge of all relevant floats. This movement (when it happens) causes margin collapsing not to occur.
When it applies to floating elements, it moves the margin edge of the element below the margin edge of all relevant floats. This affects the position of later floats, since later floats cannot be positioned higher than earlier ones.
The floats that are relevant to be cleared are the earlier floats within the same block formatting context.
Browser Compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 4.0 | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The clip
CSS property defines what portion of an element is visible. The clip
property applies only to elements with
position:absolute
.
Values
- <shape>
- A rectangular shape of the form
rect(<top>, <right>, <bottom>, <left>) /* standard syntax */
or
rect(<top> <right> <bottom> <left>) /* backwards compatible syntax */
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.
-
<top>
, <right>
, <bottom>
, and <left>
may either have a
<length>
value or auto
. - auto
- The element does not clip (default value)
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 4.0 | 7.0 | 1.0 (85) |
8.0 Correct comma syntax supported in this version. |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Syntax
clip-path: <uri> | none | inherit
Values
uri : <uri> | none | inherit
Examples
.target { clip-path: url(#c1); }
.anothertarget { clip-path: url(resources.svg#c1); }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | ? | ? | ? | ? | ? |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The color
CSS property sets the foreground color of an element's text content.
Syntax
color: <color> | inherit
Values
- <color>
- The color property accepts various keywords and numeric notations. See
<color>
values for much details.
Examples
The following are all ways to make the element's text red:
element { color: red }
element { color: #f00 }
element { color: #ff0000 }
element { color: rgb(255,0,0) }
element { color: rgb(100%, 0%, 0%) }
element { color: hsl(0, 100%, 50%) }
/* 50% translucent, support since Firefox 3 */
element { color: rgba(255, 0, 0, 0.5) }
element { color: hsla(0, 100%, 50%, 0.5) }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 3.0 | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
For the browser compatibility table for the various values, see
<color>
.
Summary
The <color>
CSS data type denotes a color in the sRGB color space. A color can be described using a keyword, using the RGB cubic-coordinate system (via the #-hexadecimal or the rgb()
and rgba()
functional notations) or using the HSL cylindrical-coordinate system (via the hsl()
and hsla()
functional notations).
Associated with the color in the sRGB space, a <color>
value also consists of an alpha-channel coordinate, transparency value, indicating how the color should composite with its background color.
Though CSS color values are precisely defined, they may appear differently on an output device. Most of them are not calibrated, and some browsers do not support output devices' color profile. Without these, color rendering may vary a lot.
Note: The
WCAG 2.0 recommendation from the W3C strongly advises web authors not to use
color as the only mean to convey a specific information, action or result. Some users have problem to distinguish colors and the conveyed information may not be grasped. Of course, this doesn't prevent the usage of color, only its usage as the only mean to describe some information.
Interpolation
Values of the <color>
CSS data type can be interpolated in order to perform animations or for creating <gradient>
values. In that case they are interpolated on each of their red, green, blue components, each handled as a real, floating-point, numbers. [1] Note that interpolation of colors happens in the alpha-premultiplied sRGBA color space to prevent unexpected grey colors to appear. In animations, the speed of the interpolation is determined by the timing function associated with the animation.
Values
There are several ways to describe a <color>
value.
Color Keywords
Color keywords are case-insensitive identifiers which represent a specific color, e.g. red, blue, brown, lightseagreen
. The name describes the color, though it is mostly artificial. The list of accepted values varied a lot through the different specification:
- CSS Level 1 only accepted 16 basic colors, named the VGA colors as they were taken from the set of displayable colors on VGA graphic cards.
- CSS Level 2 added the
orange
keyword. - From the beginning, browsers accepted other colors, mostly the X11 named colors list as some early browsers where X11 applications, though with a few differences. SVG 1.0 was the first standard to formally defined these keywords; CSS Colors Level 3 also formally defined these keywords. They are often referred as the extended color keywords, the X11 colors, the SVG colors.
There are a few caveats to consider when using keywords:
- Except the 16 basic colors which are common with HTML, the others cannot be used in HTML. HTML will convert these unknown values with a specific algorithm which will lead to completely different colors. These keywords should only be used in SVG & CSS.
- Unknown keywords make the CSS property invalid. Invalid properties being ignored, the color will have no effect. This is a different behavior than the one of HTML.
- No keyword-defined colors in CSS have any transparency, they are plain, solid colors.
- Several keywords denote the same colors:
-
darkgray
/
darkgrey
-
darkslategray
/
darkslategrey
-
dimgray
/
dimgrey
-
lightgray
/ lightgrey
-
lightslategray
/ lightslategrey
-
gray
/ grey
-
slategray
/
slategray
- Though the names of the keywords have been taken by the usual X11 color names, the color may diverge from the corresponding system color on X11 system as these are tailored for the specific hardware by the manufacturer [2].
Specifications | Color | Keyword | RGB cubic coordinates | Live Example |
CSS3 | CSS2 | CSS1 | | black | =rgb( 0, 0, 0) | |
| silver | =rgb(192, 192, 192) | |
|
gray [*]
| =rgb(128, 128, 128) | |
| white | =rgb(255, 255, 255) | |
| maroon | =rgb(128, 0, 0) | |
| red | =rgb(255, 0, 0) | |
| purple | =rgb(128, 0, 128) | |
| fuchsia | =rgb(255, 0, 255) | |
| green | =rgb( 0, 128, 0) | |
| lime | =rgb( 0, 255, 0) | |
| olive | =rgb(128, 128, 0) | |
| yellow | =rgb(255, 255, 0) | |
| navy | =rgb( 0, 0, 128) | |
| blue | =rgb( 0, 0, 255) | |
| teal | =rgb( 0, 128, 128) | |
| aqua | =rgb( 0, 255, 255) | |
| | orange | =rgb(255, 165, 0) | |
| | | aliceblue | =rgb(240, 248, 245) | |
| antiquewhite | =rgb(250, 235, 215) | |
| aquamarine | =rgb(127, 255, 212) | |
| azure | =rgb(240, 255, 255) | |
| beige | =rgb(245, 245, 220) | |
| bisque | =rgb(255, 228, 196) | |
| blanchedalmond | =rgb(255, 235, 205) | |
| blueviolet | =rgb(138, 43, 226) | |
| brown | =rgb(165, 42, 42) | |
| burlywood | =rgb(222, 184, 35) | |
| cadetblue | =rgb( 95, 158, 160) | |
| chartreuse | =rgb(127, 255, 0) | |
| chocolate | =rgb(210, 105, 30) | |
| coral | =rgb(255, 127, 80) | |
| cornflowerblue | =rgb(100, 149, 237) | |
| cornsilk | =rgb(255, 248, 220) | |
| crimson | =rgb(220, 20, 60) | |
| darkblue | =rgb( 0, 0, 139) | |
| darkcyan | =rgb( 0, 139, 139) | |
| darkgoldenrod | =rgb(184, 134, 11) | |
|
darkgray [*]
| =rgb(169, 169, 169) | |
| darkgreen | =rgb( 0, 100, 0) | |
|
darkgrey [*]
| =rgb(169, 169, 169) | |
| darkkhaki | =rgb(189, 183, 107) | |
| darkmagenta | =rgb(139, 0, 139) | |
| darkolivegreen | =rgb( 85, 107, 47) | |
| darkorange | =rgb(255, 140, 0) | |
| darkorchid | =rgb(153, 50, 204) | |
| darkred | =rgb(139, 0, 0) | |
| darksalmon | =rgb(233, 150, 122) | |
| darkseagreen | =rgb(143, 188, 143) | |
| darkslateblue | =rgb( 72, 61, 139) | |
|
darkslategray [*]
| =rgb( 47, 79, 79) | |
|
darkslategrey [*]
| =rgb( 47, 79, 79) | |
| darkturquoise | =rgb( 0, 206, 209) | |
| darkviolet | =rgb(148, 0, 211) | |
| deeppink | =rgb(255, 20, 147) | |
| deepskyblue | =rgb( 0, 191, 255) | |
|
dimgray [*]
| =rgb(105, 105, 105) | |
|
dimgrey [*]
| =rgb(105, 105, 105) | |
| dodgerblue | =rgb( 30, 144, 255) | |
| firebrick | =rgb(178, 34, 34) | |
| floralwhite | =rgb(255, 250, 240) | |
| forestgreen | =rgb( 34, 139, 34) | |
| gainsboro | =rgb(220, 220, 220) | |
| ghostwhite | =rgb(248, 248, 255) | |
| gold | =rgb(255, 215, 0) | |
| goldenrod | =rgb(218, 165, 32) | |
| greenyellow | =rgb(173, 255, 47) | |
| grey | =rgb(128, 128, 128) | |
| honeydew | =rgb(240, 255, 240) | |
| hotpink | =rgb(255, 105, 180) | |
| indianred | =rgb(205, 92, 92) | |
| indigo | =rgb( 75, 0, 130) | |
| ivory | =rgb(255, 255, 240) | |
| khaki | =rgb(240, 230, 140) | |
| lavender | =rgb(230, 230, 250) | |
| lavenderblush | =rgb(255, 240, 245) | |
| lawngreen | =rgb(124, 252, 0) | |
| lemonchiffon | =rgb(255, 250, 205) | |
| lightblue | =rgb(173, 216, 230) | |
| lightcoral | =rgb(240, 128, 128) | |
| lightcyan | =rgb(224, 255, 255) | |
| lightgoldenrodyellow | =rgb(250, 250, 210) | |
|
lightgray [*]
| =rgb(211, 211, 211) | |
| lightgreen | =rgb(144, 238, 144) | |
|
lightgrey [*]
| =rgb(211, 211, 211) | |
| lightpink | =rgb(255, 182, 193) | |
| lightsalmon | =rgb(255, 160, 122) | |
| lightseagreen | =rgb( 32, 178, 170) | |
| lightskyblue | =rgb(135, 206, 250) | |
|
lightslategray [*]
| =rgb(119, 136, 153) | |
|
lightslategrey [*]
| =rgb(119, 136, 153) | |
| lightsteelblue | =rgb(176, 196, 222) | |
| lightyellow | =rgb(255, 255, 224) | |
| limegreen | =rgb( 50, 205, 50) | |
| linen | =rgb(250, 240, 230) | |
| mediumaquamarine | =rgb(102, 205, 170) | |
| mediumblue | =rgb( 0, 0, 205) | |
| mediumorchid | =rgb(186, 85, 211) | |
| mediumpurple | =rgb(147, 112, 219) | |
| mediumseagreen | =rgb( 60, 179, 113) | |
| mediumslateblue | =rgb(123, 104, 238) | |
| mediumspringgreen | =rgb( 0, 250, 154) | |
| mediumturquoise | =rgb( 72, 209, 204) | |
| mediumvioletred | =rgb(199, 21, 133) | |
| midnightblue | =rgb( 25, 25, 112) | |
| mintcream | =rgb(245, 255, 250) | |
| mistyrose | =rgb(255, 228, 225) | |
| moccasin | =rgb(255, 228, 181) | |
| navajowhite | =rgb(255, 222, 173) | |
| oldlace | =rgb(253, 245, 230) | |
| olivedrab | =rgb(107, 142, 35) | |
transparent
Keyword
The transparent
keyword represents a fully transparent color, i.e. the color seen will be the background color. Technically, it is a black with alpha channel at its maximum and is a shortcut for rgba(0,0,0,0)
.
Historical Note The
transparent
keyword wasn't a true color in CSS Level 2 (Revision 1). It was a specific keyword that could be used in place of a regular
<color>
value on two CSS properties:
background
and
border
. It was essentially added to allow to override an inherited solid colors.
With the support of opacity through
alpha channels,
transparent
was redefined as a true color in CSS Level 3 allowing its use in any place where a
<color>
value is required, like the
color
property.
[**]
currentColor
Keyword
The currentColor
keyword represents the calculated value of the element's
color
property. It allows to make the color properties inherited by properties or child's element properties that do not inherit it by default.
It can also be used on properties that inherit the calculated value of the element's
color
property and will be equivalent to the inherit
keyword on these elements, if any.
Live Example
The color of the line (a color-filled div) adapts to the color of its
color
property, inherited from its parent
<div style="color:darkred">
The color of this text is the same as the one of the line:
<div style="background:currentcolor; height:1px"></div>
Some more text.
</div>
The color of this text is the same as the one of the line:
.
Some more text.
<div style="color:blue">
The color of this text is the same as the one of the line:
<div style="background:currentcolor; height:1px"></div>
Some more text.
</div>
The color of this text is the same as the one of the line:
.
Some more text.
RGB (red-green-blue)
- Hexadecimal notation
#RRGGBB
and #RGB
-
- "
#
", followed by six hexadecimal characters (0-9, A-F). - "
#
", followed by three hexadecimal characters (0-9, A-F).
The three-digit RGB notation (#RGB
) and the six-digit form (#RRGGBB
) are equal.
For example, #f03
and #ff0033
represent the same color. - Functional Notation
rgb(R,G,B)
- "
rgb
", followed by three
<integer>
or three
<percentage>
values.
The integer number 255 corresponds to 100%, and to F or FF in the hexadecimal notation.
/* These examples all specify the same RGB color: */
#f03
#F03
#ff0033
#FF0033
rgb(255,0,51)
rgb(255, 0, 51)
rgb(255, 0, 51.2) /* ERROR! Don't use fractions, use integers */
rgb(100%,0%,20%)
rgb(100%, 0%, 20%)
rgb(100%, 0, 20%) /* ERROR! Don't mix up integer and percentage notation */
HSL (hue-saturation-lightness) hsl(H,S,L)
The advantage of HSL over RGB is that it is far more intuitive: you can guess at the colors you want, and then tweak. It is also easier to create sets of matching colors (by keeping the hue the same and varying the lightness/darkness, and saturation).
Hue is represented as an angle of the color circle (i.e. the rainbow represented in a circle). This angle is given as a unitless
<number>
. By definition red=0=360, and the other colors are spread around the circle, so green=120, blue=240, etc. As an angle, it implicitly wraps around such that -120=240 and 480=120.
Saturation and lightness are represented as percentages.
100%
is full saturation, and 0%
is a shade of grey.
100%
lightness is white, 0%
lightness is black, and 50%
lightness is "normal".
hsl(0, 100%,50%) /* red */
hsl(30, 100%,50%)
hsl(60, 100%,50%)
hsl(90, 100%,50%)
hsl(120,100%,50%) /* green */
hsl(150,100%,50%)
hsl(180,100%,50%)
hsl(210,100%,50%)
hsl(240,100%,50%) /* blue */
hsl(270,100%,50%)
hsl(300,100%,50%)
hsl(330,100%,50%)
hsl(360,100%,50%) /* red */
hsl(120,100%,25%) /* dark green */
hsl(120,100%,50%) /* green */
hsl(120,100%,75%) /* light green */
hsl(120,100%,50%) /* green */
hsl(120, 67%,50%)
hsl(120, 33%,50%)
hsl(120, 0%,50%)
hsl(120, 60%,70%) /* pastel green */
RGBa (red-green-blue-alpha) rgba(R,G,B,a)
Extends the RGB color model to include "alpha" to allow specification of the opacity of a color.
a means opacity: 0=transparent; 1=opaque;
rgba(255,0,0,0.1) /* 10% opaque red */
rgba(255,0,0,0.4) /* 40% opaque red */
rgba(255,0,0,0.7) /* 70% opaque red */
rgba(255,0,0, 1) /* full opaque red */
HSLa (hue-saturation-lightness-alpha) hsla(H,S,L,a)
Extends the HSL color model to include "alpha" to allow specification of the opacity of a color.
a means opacity: 0=transparent; 1=opaque;
hsla(240,100%,50%,0.05) /* 5% opaque blue */
hsla(240,100%,50%, 0.4) /* 40% opaque blue */
hsla(240,100%,50%, 0.7) /* 70% opaque blue */
hsla(240,100%,50%, 1) /* full opaque blue */
System Colors
Not all system colors are supported on all systems.
Deprecated
for use on public web pages.
- ActiveBorder
- Active window border.
- ActiveCaption
- Active window caption. Should be used with CaptionText foreground color.
- AppWorkspace
- Background color of multiple document interface.
- Background
- Desktop background.
- ButtonFace
- Face background color for 3-D elements that appear 3-D due to one layer of surrounding border. Should be used with ButtonText foreground color.
- ButtonHighlight
- The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.
- ButtonShadow
- The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.
- ButtonText
- Text on push buttons. Should be used with ButtonFace or ThreeDFace background color.
- CaptionText
- Text in caption, size box, and scrollbar arrow box. Should be used with ActiveCaption background color.
- GrayText
- Grayed (disabled) text.
- Highlight
- Item(s) selected in a control. Should be used with HighlightText foreground color.
- HighlightText
- Text of item(s) selected in a control. Should be used with Highlight background color.
- InactiveBorder
- Inactive window border.
- InactiveCaption
- Inactive window caption. Should be used with InactiveCaptionText foreground color.
- InactiveCaptionText
- Color of text in an inactive caption. Should be used with InactiveCaption background color.
- InfoBackground
- Background color for tooltip controls. Should be used with InfoText foreground color.
- InfoText
- Text color for tooltip controls. Should be used with InfoBackground background color.
- Menu
- Menu background. Should be used with MenuText or -moz-MenuBarText foreground color.
- MenuText
- Text in menus. Should be used with Menu background color.
- Scrollbar
- Scroll bar gray area.
- ThreeDDarkShadow
- The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two
concentric layers of surrounding border. - ThreeDFace
- The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border. Should be used with ButtonText foreground color.
- ThreeDHighlight
- The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two
concentric layers of surrounding border. - ThreeDLightShadow
- The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two
concentric layers of surrounding border. - ThreeDShadow
- The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two
concentric layers of surrounding border. - Window
- Window background. Should be used with WindowText foreground color.
- WindowFrame
- Window frame.
- WindowText
- Text in windows. Should be used with Window background color.
Mozilla System Color Extensions
- -moz-ButtonDefault
- The border color that goes around buttons that represent the default action for a dialog box.
- -moz-ButtonHoverFace
- The background color of a button that the mouse pointer is over (which would be ThreeDFace or ButtonFace when the mouse pointer is not over it). Should be used with the -moz-ButtonHoverText foreground color.
- -moz-ButtonHoverText
- The text color of a button that the mouse pointer is over (which would be ButtonText when the mouse pointer is not over it). Should be used with the -moz-ButtonHoverFace background color.
- -moz-CellHighlight
- Background color for selected item in a tree widget. Should be used with -moz-CellHighlightText foreground color. See also -moz-html-CellHighlight.
- -moz-CellHighlightText
- Text color for a selected item in a tree. Should be used with -moz-CellHighlight background color. See also -moz-html-CellHighlightText.
- -moz-Combobox
-
Requires Gecko 1.9.2
Background color for comboboxes. Should be used with -moz-ComboboxText foreground color. In versions prior to 1.9.2, use -moz-Field instead.
- -moz-ComboboxText
-
Requires Gecko 1.9.2
Background Text color for comboboxes. Should be used with -moz-ComboboxText foreground color. In versions prior to 1.9.2, use -moz-FieldText instead.
- -moz-Dialog
- Background color for dialog boxes. Should be used with -moz-DialogText foreground color.
- -moz-DialogText
- Text color for dialog boxes. Should be used with -moz-Dialog background color.
- -moz-dragtargetzone
- -moz-EvenTreeRow
-
Requires Gecko 1.9
Background color for even-numbered rows in a tree. Should be used with -moz-FieldText foreground color. In Gecko versions prior to 1.9, use -moz-Field. See also -moz-OddTreeRow.
- -moz-Field
- textfield background color. Should be used with -moz-FieldText foreground color.
- -moz-FieldText
- textfield foreground color. Should be used with -moz-Field, -moz-EvenTreeRow, or -moz-OddTreeRow background colors.
- -moz-html-CellHighlight
-
Requires Gecko 1.9
Background color for highlighted item in HTML select. Should be used with -moz-html-CellHighlightText foreground color. Prior to Gecko 1.9, use -moz-CellHighlight.
- -moz-html-CellHighlightText
-
Requires Gecko 1.9
Background color for highlighted item in HTML select. Should be used with -moz-html-CellHighlight background color. Prior to Gecko 1.9, use -moz-CellHighlightText.
- -moz-mac-accentdarkestshadow
- -moz-mac-accentdarkshadow
- -moz-mac-accentface
- -moz-mac-accentlightesthighlight
- -moz-mac-accentlightshadow
- -moz-mac-accentregularhighlight
- -moz-mac-accentregularshadow
- -moz-mac-chrome-active
-
Requires Gecko 1.9.1
- -moz-mac-chrome-inactive
-
Requires Gecko 1.9.1
- -moz-mac-focusring
- -moz-mac-menuselect
- -moz-mac-menushadow
- -moz-mac-menutextselect
- -moz-MenuHover
- Background color for hovered menu item. Often similar to Highlight. Should be used with -moz-MenuHoverText or -moz-MenuBarHoverText foreground color.
- -moz-MenuHoverText
- Foreground color for hovered menu item. Often similar to HighlightText. Should be used with -moz-MenuHover background color.
- -moz-MenuBarText
-
Requires Gecko 1.9.2
Foreground color for text in menu bars. Often similar to MenuText. Should be used on top of Menu background.
- -moz-MenuBarHoverText
- Foreground color for hovered text in menu bars. Often similar to -moz-MenuHoverText. Should be used on top of -moz-MenuHover background.
- -moz-nativehyperlinktext
-
Requires Gecko 1.9.1
default platform hyperlink color
- -moz-OddTreeRow
-
Requires Gecko 1.9
Background color for odd-numbered rows in a tree. Should be used with -moz-FieldText foreground color. In Gecko versions prior to 1.9, use -moz-Field. See also -moz-EvenTreeRow.
- -moz-win-communicationstext
-
Requires Gecko 1.9
Should be used for text in objects with appearance:-moz-win-communications-toolbox.
- -moz-win-mediatext
-
Requires Gecko 1.9
Should be used for text in objects with appearance:-moz-win-media-toolbox.
Mozilla Color Preference Extensions
- -moz-activehyperlinktext
- User's preference for text color of active links. Should be used against default document background.
- -moz-default-background-color
-
Requires Gecko 5.0
User's preference for document background-color.
- -moz-default-color
-
Requires Gecko 5.0
User's preference for text color.
- -moz-hyperlinktext
- User's preference for text color of unvisited links. Should be used against default document background.
- -moz-visitedhyperlinktext
- User's preference for text color of visited links. Should be used against default document background.
Browser Compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
keywords colors | 1.0 | 1.0 (1.0) | 3.0 [*]
| 3.5 | 1.0 (85) |
#RRGGBB | #RGB | 1.0 | 1.0 (1.0) | 3.0 | 3.5 | 1.0 (85) |
rgb (R,G,B) | 1.0 | 1.0 (1.0) | 4.0 | 3.5 | 1.0 (85) |
hsl (H,S,L) | 1.0 | 1.0 (1.5) | 9.0 [4]
| 9.5 | 3.1 (525) |
rgba (R,G,B,a) | 1.0 | 3.0 (1.9) | 9.0 #
| 10.0 | 3.1 (525) |
hsla (H,S,L,a) | 1.0 | 3.0 (1.9) | 9.0 #
| 10.0 | 3.1 (525) |
currentColor | 1.0 | 1.5 (1.8) | 9.0 [5]
| 9.5 | 4.0 (528) |
transparent | 1.0 | 3.0 (1.9) | 9.0 [6][**]
| 10.0 | 3.1 (525) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
[*] The 'e'-grey colors (with an e) (grey
, darkgrey
, darkslategrey
, dimgrey
, lightgrey
, lightslategrey
) are only supported since IE 8.0. IE 3 to IE 6 only support the 'a' variants: gray
, darkgray
, darkslategray
, dimgray
, lightgray
, lightslategray
.
[**] IE 7-8 supports transparent only for
background
and
border
. color:transparent
is drawn black in IE.
See also
- The
opacity
property, allowing to define the transparency of color at the element level. - The
color
,
background-color
,
border-color
,
outline-color
,
text-shadow
,
box-shadow
properties. -
CSS Reference index
- CSS Data Types :
<angle>
, <color>
, <frequency>
, <identifier>
, <integer>
, <length>
, <number>
, <percentage>
, <ratio>
, <resolution>
, <shape>
, <string>
, <time>
, <timing-function>
, <uri>
Summary
The column-count
CSS property describes the number of columns of the element.
Syntax
column-count: integer or
column-count: auto
where :
- auto
- Is a keyword indicating that the number of columns should be determined by other CSS properties, like
column-width
. - integer
- Is a strictly positive
<integer>
describing the ideal number of columns into which the content of the element will be flowed. If the
column-width
is also set to a non-auto value, it merely indicates the maximum allowed number of columns.
Examples
.content-box {
border: 10px solid #000000;
column-count:3;
}
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 1.5 (1.8)
-moz
| 10 | 11.1 | 3.0 (522)
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | (Supported) | ? | ? | ? |
Summary
The column-gap
CSS property sets the size of the gap between columns for elements which are specified to display as a multi-column element.
Syntax
column-gap: length or
column-gap: normal
where :
normal
- Is a keyword indicating to use the browser-defined default spacing between columns. The specification, and most modern browsers follow it, recommends this keyword to be equal to a length of
1em
. - length
- Is a
<length>
value defining the size of the gap between columns. It must not be negative, but may be equal to 0
.
Examples
.content-box {
border: 10px solid #000000;
column-count: 3;
column-gap: 20px;
}
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 1.5 (1.8)
-moz [*] | 10 | 11.1 | 3.0 (522)
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | (Supported) | ? | ? | ? |
[*] Before Firefox 3 (Gecko 1.9), the default value associated to the normal
keyword was 0
and not 1em
.
Summary
The column-rule-color
CSS property lets you set the color of the rule drawn between columns in multi-column layouts.
Syntax
column-rule-color: <color>
Example
#header {column-rule-color: blue;
}
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 3.5 (1.9.1)
-moz
| 10 | 11.1 | 3.0 (522)
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | (Supported) | ? | ? | ? |
Summary
In multi-column layouts, the column-rule
CSS property specifies a straight line, or "rule", to be drawn between each column. It is a convenient shorthand to avoid setting each of the individual column-rule-*
properties separately :
column-rule-width
,
column-rule-style
and
column-rule-color
.
Syntax
column-rule: <border-width> || <border-style> || <color>
Values
Accepts one, two or three values in any order:
- <border-width>
-
Optional, is one value or keyword of:
<length>
| thin | medium | thick
Default value medium
is used if absent. See
border-width
for details. - <border-style>
-
Required, default value
none
is used if absent. See
border-style
for possible values and details. - <color>
-
Optional, see
<color>
value. Default value if absent:
currentColor
, the value of the element's color
property (foreground color).
Examples
p.foo { column-rule: dotted; } /* same as "medium dotted currentColor" */
p.bar { column-rule: solid blue; } /* same as "medium solid blue" */
p.baz { column-rule: solid 8px; } /* same as "8px solid currentColor" */
p.abc { column-rule: thick inset blue;
}
Live Example
padding:0.3em; background:gold; border:groove 2px gold; column-rule: inset 2px gold; column-width:17em;
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 3.5 (1.9.1)
-moz
| 10 | 11.1 | 3.0 (522)
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | (Supported) | ? | ? | ? |
Summary
The column-rule-style
CSS property lets you set the style of the rule drawn between columns in multi-column layouts.
Syntax
column-rule-style: <border-style>
Example
#header {-moz-column-rule-style: inset;
}
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 3.5 (1.9.1)
-moz
| 10 | 11.1 | 3.0 (522)
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | (Supported) | ? | ? | ? |
Summary
The column-rule-width
CSS property lets you set the width of the rule drawn between columns in multi-column layouts.
Syntax
column-rule-width: <border-width>
Example
#header {column-rule-width: thick;
}
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 3.5 (1.9.1)
-moz
| 10 | 11.1 | 3.0 (522)
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | (Supported) | ? | ? | ? |
Summary
The columns
CSS property is a shorthand property allowing to set both the
column-width
and the
column-count
properties at the same time.
Syntax
columns: <column-count> || <column-width>
where :
- <column-width>
- Is a
<length>
value giving a hint of the optimal width of the column. The actual column width may be wider (to fill the available space), or narrower (only if the available space is smaller than the specified column width). The length must be strictly positive or the declaration is invalid. - <column-count>
- Is a strictly positive
<integer>
describing the ideal number of columns into which the content of the element will be flowed. If the
column-width
is also set to a non-auto value, it merely indicates the maximum allowed number of columns.
Examples
.content-box {
border: 10px solid #000000;
columns:3;
}
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 9 (9)
-moz
| 10 | 11.1 | 3.0 (522)
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | (Supported) | ? | ? | ? |
Summary
The column-width
CSS property suggests an optimal column width. This is not a absolute value but a mere hint. Browser will adjust the width of the column around that suggested value, allowing to achieve scalable designs that fit different screen size. Especially in presence of the
column-count
CSS property which has precedence, to set an exact column width, all length values must be specified. In horizontal text these are
width
,
column-width
,
column-gap
, and
column-rule-width
.
Syntax
column-width: length or
column-width: auto
where :
- length
- Is a
<length>
value giving a hint of the optimal width of the column. The actual column width may be wider (to fill the available space), or narrower (only if the available space is smaller than the specified column width). The length must be strictly positive or the declaration is invalid. -
auto
- Is a keyword indicating that the width of the column should be determined by other CSS properties, like
column-count
.
Examples
.content-box {
border: 10px solid #000000;
column-width: 300px;
}
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 1.5 (1.8)
-moz
| 10 | 11.1 | 3.0 (522)
-webkit
|
Intrinsic sizes | -- | -- | -- | -- | -- |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | (Supported) | ? | ? | ? |
Intrinsic sizes | -- | -- | -- | -- | -- |
« CSS « CSS Reference
Summary
Comments are used to add explanatory notes or prevent the browser from interpreting parts of the stylesheet.
Examples
/* A single line comment */
/*
A comment
which stretches
over several
lines
*/
Notes
The /* */
comment syntax is used for both single and multi line comments. There is no other way to specify comments in external stylesheets. However, when using the <style>
element, you may use <!-- -->
to hide CSS from older browsers, although this is not recommended. As in most programming languages that use the /* */
comment syntax, comments cannot be nested. In other words, the first instance of */
that follows an instance of /*
closes the comment.
« CSS « CSS Reference
Summary
The content
CSS property is used with the
:before
and
:after
pseudo-elements to generate content in an element.
-
Initial value
:
normal
- Applies to: pseudo-elements
:before
and :after
-
Inherited
: no
- Media: all
-
Computed value
:
- on
:before
and :after
, normal
computes to none
- on elements, always computes to
normal
- for URI values, the absolute URI
- for
attr()
values, the resulting string - for other keywords, as specified.
Syntax
content: normal | none |
[ <string> | <uri> | <counter> | attr() |
open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit
Values
- none
- The pseudo-element is not generated.
- normal
- Computes to
none
for the :before
and :after
pseudo-elements. - <string>
- Text content.
- <uri>
url()
- The value is a URI that designates an external resource (such as an image). If the resource or image can't be displayed, it is either ignored or some placeholder shows up.
- <counter>
- [fixme] Counters may be specified with two different functions: 'counter()' or 'counters()'. The former has two forms: 'counter(name)' or 'counter(name, style)'. The generated text is the value of the innermost counter of the given name in scope at this pseudo-element; it is formatted in the indicated style ('decimal' by default). The latter function also has two forms: 'counters(name, string)' or 'counters(name, string, style)'. The generated text is the value of all counters with the given name in scope at this pseudo-element, from outermost to innermost separated by the specified string. The counters are rendered in the indicated style ('decimal' by default). See the section on automatic counters and numbering for more information. The name must not be 'none', 'inherit' or 'initial'. Such a name causes the declaration to be ignored.
- attr(X)
- Returns the value of the element's attribute X as a string. If there is no attribute X, an empty string is returned. The case-sensitivity of attribute names depends on the document language.
- open-quote | close-quote
- These values are replaced by the appropriate string from the
quotes
property. - no-open-quote | no-close-quote
- Introduces no content, but increments (decrements) the level of nesting for quotes.
Examples
q:lang(en) { quotes: '"' '"' "'" "'" }
q:before { content: open-quote }
q:after { content: close-quote }
h1:before { content: "Chapter: "; }
/* content accepts multiple values */
a:before { content: url(http://www.mozilla.org/favicon.ico) " MOZILLA: ";
font: x-small Arial,freeSans,sans-serif;
color: gray;
}
View on jsFiddle
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 8.0 | 4.0 | 1.0 (85) |
url() support | 1.0 | 1.0 (1.0) | 8.0 | 7.0 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
counter-increment
is used to increase the value of CSS Counters by a given value.
Syntax
counter-increment: [<identifier> <integer>?]+ | inherit | none
Values
identifier
- The name of the counter to increment.
integer
- The value to add to the counter. Defaults to 1 if not given.
You may specify as many counters to increment as you want, each separated by a space.
Examples
h1 {
counter-increment: chapter section 2 page;
/* Increases the value of the chapter and page counters by 1
and the section counter by 2. */
}
Notes
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 2.0 | 1.0 (?) | 8.0 | 9.2 | 3.0 (?) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
counter-reset
is used to reset CSS Counters to a given value.
Syntax
counter-reset: [<identifier> <integer>?]+ | inherit | none
Values
- identifier
- The name of the counter to reset.
- integer
- The value to reset the counter to on each occurrence of the element. Defaults to 0 if not given.
You may specify as many counters to reset as you want, each separated by a space.
Examples
h1 {
counter-reset: chapter section 1 page;
/* Sets the chapter and page counters to 0
and the section counter to 1. */
}
Notes
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 2.0 | 1.0 (?) | 8.0 | 9.2 | 3.1 (?) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The cursor
CSS property specifies the mouse cursor displayed when the mouse pointer is over an element.
Syntax
CSS 2.1
cursor:
[ [
<uri>
,]*
[ auto | crosshair | default | help | move | pointer | progress | text | wait | e-resize |
ne-resize | nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize ] ]
] | inherit
CSS 3
cursor:
[ [
<uri>
[<x> <y>]?,]*
[ auto | 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 ]
] | inherit
Values
- <uri>
- Optional.
A url(…)
or a comma separated list url(…), url(…), …
, pointing to an image file. More than one
<uri>
may be provided as fallback, in case some cursor image types are not supported. A non-URL fallback (one ore more of the other values) must be at the end of the fallback list. See Using URL values for the cursor property for more details. - <x> <y>
- Optional x- and y-coordinates (not supported by Internet Explorer). Two unit-less numbers.
Supported CSS standard values
Category | CSS value move mouse over for testing
| | Description |
General | auto | | The browser determines the cursor to display based on the current context. E.g. equivalent to text when hovering text. |
default |  | Default cursor, typically an arrow. |
none | | No cursor is rendered
New in Firefox 3
|
Links & status | context-menu |  | A context menu is available under the cursor. In Gecko/Firefox not implemented on Windows,
bug 258960
WONTFIX. |
help |  | Indicating help is available. |
pointer |  | E.g. used when hovering over links, typically a hand. |
progress |  | The program is busy in the background but the user can still interact with the interface (unlike for wait ). |
wait |  | The program is busy (sometimes an hourglass or a watch). |
Selection | cell |  | Indicating that cells can be selected. |
crosshair |  | Cross cursor, often used to indicate selection in a bitmap. |
text |  | Indicating text can be selected, typically an I-beam. |
vertical-text |  | Indicating that vertical text can be selected, typically a sideways I-beam. |
Drag and drop | alias |  | Indicating an alias or shortcut is to be created. |
copy |  | Indicating that something can be copied. |
move |  | The hovered object may be moved. |
no-drop |
Cursor showing that a drop is not allowed at the current location.
bug 275173
on Windows, "no-drop is the same as not-allowed". |
not-allowed |  | Cursor showing that something cannot be done. |
Resize & scrolling | all-scroll |  | Cursor showing that something can be scrolled in any direction (panned).
bug 275174
on Windows, "all-scroll is the same as move". |
col-resize |  | The item/column can be resized horizontally. Often rendered as arrows pointing left and right with a vertical bar separating. |
row-resize |  | The item/row can be resized vertically. Often rendered as arrows pointing up and down with a horizontal bar separating them. |
n-resize |  | Some edge is to be moved. For example, the se-resize cursor is used when the movement starts from the south-east corner of the box. |
e-resize |  |
s-resize |  |
w-resize |  |
ne-resize |  |
nw-resize |  |
se-resize |  |
sw-resize |  |
ew-resize | | Indicates a bidirectional resize cursor. |
ns-resize | |
nesw-resize | |
nwse-resize | |
Mozilla extensions
CSS value | Description | dropped | deprecated since |
-moz-cell |
Obsolete, use cell . | Gecko 1.9.2 (Firefox 3.6) | Gecko 1.8 (Firefox 1.5) |
-moz-alias |
Obsolete, use alias.
| Gecko 2 (Firefox 4) |
-moz-context-menu |
Obsolete, use context-menu.
|
-moz-copy |
Obsolete, use copy.
|
-moz-spinning |
Obsolete, use progress.
| Gecko 1.7.1 (Firefox 1.0) |
Notes
Gecko 2.0 note
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Support for loading a cursor from a URI was added for Mac OS X in Gecko 2.0; prior to that it was not supported on OS X.
Examples
.foo { cursor: crosshair; }
.bar { cursor: move; cursor: cell; } /* use move if cell isn't supported */
.baz { url(hyper.cur), auto } /* standard cursor value as fallback must be provided */
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
auto | crosshair | default | move | text | wait | help | n-resize | e-resize | s-resize |w-resize | ne-resize | nw-resize | se-resize | sw-resize
| 1.0 | 1.0 (1.0) | 4.0 | 7.0 | 1.2 (125) |
hand Non-standard (use pointer )
| --
| --
| 4.0 | 7.0 | -- |
pointer
| 1.0 | 1.0 (1.0) | 6.0 | 7.0 | 1.2 (125) |
progress
| 1.0 | 1.0 (1.7.1) | 6.0 | 7.2 | 3.0 (522) |
url()
See Using URL values
| 1.0 | 1.5 (1.8) | 6.0 | --
| 3.0 (522-523) |
not-allowed | no-drop | vertical-text | all-scroll | col-resize | row-resize | 1.0 | 1.5 (1.8) | --
| --
| 3.0 (522) |
none | 5.0 | 3.0 (1.9) | --
| --
| 5.0 (533) |
inherit | 1.0 | 1.0 | 8.0 | 9.0 | 1.2 |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The direction
property should be set to match the direction of the text: rtl
for Hebrew or Arabic text and ltr
for other scripts. This should normally be done as part of the document (e.g., using the dir
attribute in HTML) rather than through direct use of CSS.
The property sets the base text direction of block-level elements and the direction of embeddings created by the
unicode-bidi
property. It also sets the default alignment of text and block-level elements and the direction that cells flow within a table row.
Syntax
direction: [ ltr | rtl | inherit ] ;
Values
- ltr
- The default value of
direction
. Text and other elements go from left to right - rtl
- Text and other elements go from right to left
For the direction
property to have any effect on inline-level elements, the
unicode-bidi
property's value must be 'embed' or 'override'.
Examples
blockquote {
direction : rtl ;
}
Notes
Unlike the dir
attribute in HTML, the direction
property is not inherited from table columns into table cells, since CSS inheritance follows the document tree, and table cells are inside of the rows but not inside of the columns.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 2.0 | 1.0 (1.7 or earlier)
| 5.5 | 9.2 | 1.3 |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 1.0 | 1.0 (1.0)
| 6 | 8 | 3.1 |
« CSS « CSS Reference
Summary
The display
CSS property specifies the type of rendering box used for an element. In HTML, default display
property values are taken from behaviors described in the HTML specifications or from the browser/user default stylesheet. The default value in XML is inline
.
In addition to the many different display box types, the value none
allows the display of an element to be turned off; all child elements also have their display turned off. The document is rendered as though the element did not exist in the document tree.
Syntax
display: <display-value> |
inherit
Values
<display-value> can be any of the following values:
- none
- Turns off the display of an element (it has no effect on layout); all child elements also have their display turned off. The document is rendered as though the element did not exist.
To render an element box's dimensions, yet have its contents be invisible, see the
visibility
property. - inline
- The element generates one or more inline element boxes.
- block
- The element generates a block element box.
- inline-block
Requires Gecko 1.9
- Introduced in CSS 2.1. The element generates a block element box that will be flowed with surrounding content as if it were a single inline box (behaving much like a replaced element would).
- list-item
- The element generates a block box for the content and a separate list-item inline box.
- compact
- Unsupported, dropped from the CSS 2.1 standard.
- run-in
- Dropped from the final CSS 2.1 standard (but may be in CSS 3), but supported by other browsers.
Unimplemented (see
bug 2056
)
in Gecko/Firefox
- If the
run-in
box contains a block box, same as block
. - If a block box follows the
run-in
box, the run-in
box becomes the first inline box of the block box. - If a inline box follows, the
run-in
box becomes a block
box.
- table
- Behaves like the
<table>
HTML element. - inline-table
New in Firefox 3
- The
inline-table
value does not have a direct mapping in HTML. - table-caption
- Behaves like the
<caption>
HTML element. - table-column | table-column-group
- These elements behave like the corresponding
<col>
and <colgroup>
HTML elements. - table-header-group | table-row-group | table-footer-group
- These elements behave like the corresponding
<thead> | <tbody> | <tfoot>
HTML elements. - table-row
- Behaves like the
<tr>
HTML element. - table-cell
- Behaves like the
<td>
HTML element.
Mozilla Extensions
These display
values are not intended for use in web content. [fixme: needs update]
- -moz-inline-block
Obsolete
- Never supported reliably.
- -moz-inline-table
Obsolete
- Never supported.
- -moz-box
- Child elements are laid out horizontally or vertically (based on the value of the
-moz-box-orient
property). - -moz-inline-box
- -moz-groupbox
- -moz-grid
- -moz-inline-grid
- Child elements are laid out as a XUL
grid
. - -moz-grid-group
- Child elements are laid out as a group of grid columns or rows. This is the layout used by the rows and columns elements. You can use the orientation (
-moz-box-orient
) to set which direction. Rows would normally have vertical orientation and columns would have a horizontal orientation. - -moz-grid-line
- Child elements are laid out as a single column or row of a grid. You can use the orientation (
-moz-box-orient
) to set which direction. - -moz-stack
- Child elements are laid out one on top of each other like the XUL
stack
element. - -moz-inline-stack
- Child elements, including
inline-block, block
, and -moz-inline-stack
are laid out atop one another. - -moz-deck
- Child elements are laid out one on top of each other like the XUL
deck
element. Unlike a stack, only the top element is displayed. - -moz-popup
- -moz-marker
Examples
View Live Examples
p.secret { display: none }
<p style="display:none"> invisible text </p>
Notes
"Block" versus "in-line" elements
-
Block-level elements create vertically distinct blocks of content - generally using a line-break before and after the content. Only this value for the
display
is allowed to generate a positioned element. Block behavior is exhibited by such HTML elements as <p>
, <div>,
<blockquote>
or <h1>
. display
property values creating a block element type: block
, list-item
, table
, compact
and run-in
.
-
In-line elements do not create distinct blocks of content; element content is rendered using a line box (content is distributed line by line within a containing physical or virtual block element.) In-line behavior is exhibited by such HTML elements as physical and virtual character formatting, non-floated images and unmarked content.
display
property values creating an in-line element type: inline
, inline-block, inline-table
and run-in
. An inline element's height is fixed to height of line which contains this element, so its height cannot be changed by CSS properties such as "padding" or "margin" except "line-height".
Requires Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
XBL bindings and display:none
Starting in Gecko 2.0, XBL bindings are no longer attached to elements when in subtrees of the DOM styled with display: none
when they're first accessed from JavaScript, unless the elements in question are XUL.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
none | inline | block | 1.0 | 1.0 (1.0) | 4.0 | 7.0 | 1.0 (85) |
inline-block | 1.0 | 3.0 (1.9) | 5.5 (-7.0) natural inline elements only | 7.0 | 1.0 (85) |
list-item | 1.0 | 1.0 (1.0) | 6.0 | 7.0 | 1.0 (85) |
run-in Non-standard | 1.0 Not before inline-elements |
-- | 8.0 | 7.0 | 1.0 (85) Not before inline-elements |
4.0 | 5.0 (532.5) |
inline-table | 1.0 | 3.0 (1.9) | 8.0 | 7.0 | 1.0 (85) |
CSS 2.1 values | 1.0 | 1.0 (1.0) except run-in , inline block , and inline-table
| 8.0 | 7.0 | 1.0 (85) |
3.0 (1.9) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
empty-cells
CSS property specifies how user agent should render borders and backgrounds around cells that have no visible content.
Syntax
empty-cells: show | hide | inherit
Values
-
inherit
- show
- borders and backgrounds should be drawn like a normal cells
- hide
- no borders or backgrounds should be drawn
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | 1.0 | 1.0 (1.7 or earlier)
| 8.0 | 4.0 | 1.2 |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 1 | 1.0 (1.0)
| 8 | 6 | 3.1 |
Firefox 3.5 introduces a number of new features, as well as additional and improved support for a wide variety of web standards. This article offers an extensive list, with links to articles covering the major improvements.
New developer features in Firefox 3.5
For web site and application developers
HTML 5 support
- Using audio and video
- Firefox 3.5 adds support for the HTML 5
audio
and video
elements. - Offline resources in Firefox
- Firefox 3.5 now fully supports the HTML 5 offline resource specification.
- Drag and drop
- The HTML 5 drag and drop API allows support for dragging and dropping items within and between web sites. This also provides a simpler API for use by extensions and Mozilla-based applications.
New DOM features
- localStorage
- Firefox 3.5 adds support for the Web Storage
localStorage
property, which provides a way for web applications to store data locally on the client's computer. - Using web workers
- Firefox 3.5 supports web workers to allow easy multi-threading support in web applications.
- Using geolocation
- Firefox 3.5 supports the Geolocation API, which allows web applications to obtain information about the user's current location if a provider for that information is installed and enabled.
- Locating DOM elements using selectors
- The selectors API allows querying a document to locate the elements that match a given selection rule.
- Mouse gesture events
- Firefox 3.5 supports mouse gesture events such as trackpad swipes.
- The
NodeIterator
object - The
NodeIterator
object provides support for iterating over the list of the nodes in a DOM subtree. - The MozAfterPaint event
- This new DOM event is sent after painting updates in windows.
- The MozMousePixelScroll event
- This new DOM event allows detection of pixel-based mouse scroll wheel events instead of line-based scroll events.
Networking
- Cross-site access controls for HTTP
- In Firefox 3.5, it's now possible for HTTP requests, including those made by
XMLHttpRequest
, to work across domains if the server supports it. -
Progress events for
XMLHttpRequest
- Progress events are now offered to enable extensions to monitor the progress of requests.
- Improved Synchronous
XMLHttpRequest
support -
DOM Timeout and Input Events are now suppressed during a synchronous
XMLHttpRequest
. - Controlling DNS prefetching
- Firefox 3.5 provides DNS prefetching, whereby it performs domain name resolution ahead of time for links included in the current page, in order to save time when links are actually clicked. This article describes how you can tune your web site to disable prefetching, or to adjust how prefetching operates.
New Canvas features
- HTML 5 text API for
canvas
elements - Canvas elements now support the HTML 5 text API.
- Shadow effects in a
canvas
- Canvas shadow effects are now supported.
createImageData()
- The canvas method
createImageData()
is now supported, allowing code to specifically create an ImageData
object instead of requiring it to be done automatically. This can improve performance of other ImageData
methods by preventing them from having to create the object. -
moz-opaque
attribute - Added the
moz-opaque
DOM attribute, which lets the canvas know whether or not translucency will be a factor. If the canvas knows there's no translucency, painting performance can be optimized.
Miscellaneous new features
- ICC color correction in Firefox
- Firefox 3.5 now supports ICC color correction for tagged images.
- The
defer
attribute is now supported on script
elements - This attribute indicates to the browser that it may choose to continue to parse and render the page without waiting for the script to finish executing.
Other improvements
- The Text node's
wholeText
property and replaceWholeText()
method have been implemented. - The property
element.children
has been added. It returns a collection of child elements of the given element. - The property
element.contentEditable
is now supported, to support editable elements. - The Element Traversal API is now supported by the DOM Element object.
- HTML document nodes may now be cloned using
cloneNode()
. - The non-standard
getBoxObjectFor()
DOM method has been removed. You should be using getBoundingClientRect()
instead. - Dispatched DOM events can now be re-dispatched. This makes Firefox 3.5 pass Acid 3 test 30.
- Improvements have been made to DOM 2 Range handling.
- In non-chrome scope, caught objects in exceptions are now the actual thrown object instead of an XPConnect wrapper containing the thrown object.
- SVG ID references are now live.
- SVG filters now work for
foreignObject
. - The
GetSVGDocument()
method has been added to object
and iframe
elements for compatibility. - Implicit setting of properties in object and array initializers no longer execute setters in JavaScript. See the blog post Object and array initializers should not invoke setters when evaluated for details.
- The
gDownloadLastDir.path
variable has been renamed to gDownloadLastDir.file
since it refers to an
nsIFile
, not a path. - The
gDownloadLastDirPath
variable has been renamed to gDownloadLastDirFile
since it refers to an
nsIFile
, not a path. - Starting in Firefox 3.5, you can no longer use
data:
bindings in chrome packages that get XPCNativeWrapper
automation.
For XUL and add-on developers
If you're an extension developer, you should start by reading Updating extensions for Firefox 3.5, which offers a helpful overview of what changes may affect your extension.
New components and functionality
- Supporting private browsing mode
- Firefox 3.5 offers Private Browsing mode, which doesn't record the user's activities. Extensions may support private browsing following the guidelines offered by this article.
- Security changes in Firefox 3.5
- This article covers security-related changes in Firefox 3.5.
- Theme changes in Firefox 3.5
- This article covers theme-related changes in Firefox 3.5.
- Monitoring WiFi access points
- Code with UniversalXPConnect privileges can now monitor the list of available access points, getting information on their SSIDs, MAC addresses, and signal strength. This can be used in tandem with Geolocation to offer WiFi-based location service.
Notable changes and improvements
- The XUL
textbox
widget now offers a search
type, for use as search fields. - In order to support dragging and dropping tabs between windows, the
browser
widget now has a swapDocShells()
method. - Added the
level
attribute to the panel
element; this specifies whether panels appear on top of other applications, or just on top of the window the panel is contained within. - XUL elements now support the
clientHeight
, clientWidth
, scrollHeight
, and scrollWidth
properties. -
keyset
s now include a disabled
attribute. - In addition,
keyset
s can now be removed using the node's removeChild()
method. -
mozIStorageStatement
had the initialize()
method removed; consumers should use the createStatement()
method instead to get a new statement object. - The Storage API now offers support for asynchronous requests.
- The
nsICookie2
interface now exposes the time at which cookies were created in its new creationTime
attribute. - Added a flag to
nsIProtocolHandler
(URI_IS_LOCAL_RESOURCE
) that is checked during chrome registration to make sure a protocol is allowed to be registered. - Firefox now looks for plugins in
/usr/lib/mozilla/plugins
on Linux, as well as the previously supported locations. - The plugin API has been updated to include support for private browsing mode; you may now use
NPN_GetValue()
to query the state of private browsing mode using the variable NPNVprivateModeBool
.
New features for end users
User experience
- Location aware browsing
- If you choose, you may allow Firefox 3.5 to share information about your current location with web sites. Firefox 3.5 can use information about the network you're connected to to share your location. Of course, it asks for your permission before doing so, to ensure your privacy.
- Open audio and video support
- Firefox 3.5 supports embedded video and audio using the open Ogg format, as well as WAV for audio. No plugins, no confusing error messages about needing to install something or other that turns out not to be available on your platform anyway.
- Local data storage
- Web applications can now use Web Storage's local storage capabilities to store data on your computer. This is great for anything from site preferences to more complex data.
Security and privacy
- Private Browsing
- Need to use someone else's computer? Switch on Private Browsing mode and nothing will be recorded about your session, including cookies, history, and any other potentially private information.
- Better privacy controls
- The Privacy preference pane has been completely redesigned to offer users more control over their private information. Users can choose to retain or discard anything including history information, cookies, downloads, and form field information. In addition, users can specify whether or not to include history and/or bookmarks in the location bar's automated suggestions, so you can keep private web addresses from popping up unexpectedly while typing in the location bar.
Performance
- Faster JavaScript performance
- JavaScript, the "J" in "AJAX," is sped up dramatically in Firefox 3.5 with the new TraceMonkey JavaScript engine. Web applications are much faster than in Firefox 3.
- Faster page rendering
- Web content draws faster in Firefox 3.5, thanks to technologies such as "speculative parsing." Your users don't need to know what it means, other than "it makes things draw faster."
If you're a developer trying to get a handle on all the new features in Firefox 3, this is the perfect place to start. This article provides a list of the new articles covering features added to Firefox 3. While it doesn't necessarily cover every little change, it will help you learn about the major improvements.
New developer features in Firefox 3
For web site and application developers
- Updating web applications for Firefox 3
- Provides information about changes you may need to make to your web site or web application to take advantage of new features in Firefox 3.
- Online and offline events
- Firefox 3 supports WHATWG online and offline events, which let applications and extensions detect whether or not there's an active Internet connection, as well as to detect when the connection goes up and down.
- Web-based protocol handlers
- You can now register web applications as protocol handlers using the
navigator.registerProtocolHandler()
method.
- Drawing text using a canvas
- You can now draw text in a canvas using a non-standardized API supported by Firefox 3.
- Transform support for canvas
- Firefox now supports the
transform()
and setTransform()
methods on canvases.
- Using microformats
- Firefox now has APIs for working with microformats.
- Drag and drop events
- Firefox 3 supports new events that are sent to the source node for a drag operation when the drag begins and ends.
- Focus management in HTML
- The new HTML 5
activeElement
and hasFocus
attributes are supported.
- Offline resources in Firefox
- Firefox now lets web applications request that resources be cached to allow the application to be used while offline.
- CSS improvements in Firefox 3
- Firefox 3 features a number of improvements in its CSS support.
- DOM improvements in Firefox 3
- Firefox 3 offers a number of new features in Firefox 3's DOM implementation, including support for several Internet Explorer extensions to the DOM.
- JavaScript 1.8 support
- Firefox 3 offers JavaScript 1.8.
- EXSLT support
- Firefox 3 provides support for a substantial subset of the EXSLT extensions to XSLT.
- SVG improvements in Firefox 3
- SVG support in Firefox 3 has been upgraded significantly, with support for over two dozen new filters, several new elements and attributes, and other improvements.
- Animated PNG graphics
- Firefox 3 supports the animated PNG (APNG) image format.
For XUL and extension developers
Notable changes and improvements
- Updating extensions for Firefox 3
- Provides a guide to the things you'll need to do to update your extension to work with Firefox 3.
- XUL improvements in Firefox 3
- Firefox 3 offers a number of new XUL elements, including new sliding scales, the date and time pickers, and spin buttons.
- Templates in Firefox 3
- Templates have been significantly improved in Firefox 3. The key improvement allows the use of custom query processors to allow data sources other than RDF to be used.
- Securing updates
- In order to provide a more secure add-on upgrade path for users, add-ons are now required to provide a secure method for obtaining updates before they can be installed. Add-ons hosted at AMO automatically provide this. Any add-ons installed that do not provide a secure update method when the user upgrades to Firefox 3 will be automatically disabled. Firefox will however continue to check for updates to the extension over the insecure path and attempt to install any update offered (installation will fail if the update also fails to provide a secure update method).
- Places migration guide
- An article about how to update an existing extension to use the Places API.
- Download Manager improvements in Firefox 3
- The Firefox 3 Download Manager features new and improved APIs, including support for multiple progress listeners.
- Using nsILoginManager
- The Password Manager has been replaced by the new Login Manager.
- Embedding XBL bindings
- You can now use the
data:
URL scheme from chrome code to embed XBL bindings directly instead of having them in separate XML files.
- Localizing extension descriptions
- Firefox 3 offers a new method for localizing add-on metadata. This lets the localized details be available as soon as the add-on has been downloaded, as well as when the add-on is disabled.
- Localization and Plurals
- Firefox 3 adds the new PluralForm module, which provides tools to aid in correctly pluralizing words in multiple localizations.
- Theme changes in Firefox 3
- Notes and information of use to people who want to create themes for Firefox 3.
New components and functionality
- FUEL Library
- FUEL is about making it easier for extension developers to be productive, by minimizing some of the XPCOM formality and adding some "modern" JavaScript ideas.
- Places
- The history and bookmarks APIs have been completely replaced by the new Places API.
- Idle service
- Firefox 3 offers the new
nsIIdleService
interface, which lets extensions determine how long it's been since the user last pressed a key or moved their mouse.
- ZIP writer
- The new
nsIZipWriter
interface lets extensions create ZIP archives.
- Full page zoom
- Firefox 3 improves the user experience by offering full page zoom in addition to text-only zoom.
- Interfacing with the XPCOM cycle collector
- XPCOM code can now take advantage of the cycle collector, which helps ensure that unused memory gets released instead of leaking.
- The Thread Manager
- Firefox 3 provides the new
nsIThreadManager
interface, along with new interfaces for threads and thread events, which provides a convenient way to create and manage threads in your code.
- JavaScript modules
- Firefox 3 now offers a new shared code module mechanism that lets you easily create modules in JavaScript that can be loaded by extensions and applications for use, much like shared libraries.
- The
nsIJSON
interface - Firefox 3 offers the new
nsIJSON
interface, which offers high-performance encoding and decoding of JSON strings.
- The nsIParentalControlsService interface
- Firefox 3 now supports the Microsoft Windows Vista parental controls feature, and allows code to interact with it.
- Using content preferences
- Firefox 3 includes a new service for getting and setting arbitrary site-specific preferences that extensions as well as core code can use to keep track of their users' preferences for individual sites.
- Plug-in Monitoring
- A new component of the plugin system is now available to measure how long it takes plugins (e.g., Macromedia Flash) to execute their calls.
New features for end users
User experience
-
Easier password management. An information bar at the top of the browser window now appears to allow you to save passwords after a successful login.
-
Simplified add-on installation. You can now install extensions from third-party download sites in fewer clicks, thanks to the removal of the add-on download site whitelist.
-
New Download Manager. The download manager makes it easier to locate your downloaded files.
-
Resumable downloads. You can now resume downloads after restarting the browser or resetting your network connection.
-
Full page zoom. From the View menu and using keyboard shortcuts, you can now zoom in and out on the content of entire pages -- this scales not just the text but the layout and images as well.
-
Tab scrolling and quickmenu. Tabs are easier to locate with the new tab scrolling and tab quickmenu features.
-
Save what you were doing. Firefox 3 prompts you to see if you'd like to save your current tabs when you exit Firefox.
-
Optimized Open in Tabs behavior. Opening a folder of bookmarks in tabs now appends the new tabs instead of replacing the existing ones.
-
Easier to resize location and search bars. You can now easily resize the location and search bars using a simple resize handle between them.
-
Text selection improvements. You can now select multiple ranges of text using the Control (Command on Macintosh) key. Double-clicking and dragging now selects in "word-by-word" mode. Triple-clicking selects an entire paragraph.
-
Find toolbar. The Find toolbar now opens with the current selection.
-
Plugin management. Users can now disable individual plugins in the Add-on Manager.
-
Integration with Windows Vista. Firefox's menus now display using Vista's native theme.
-
Integration with Mac OS X. Firefox now supports Growl for notifications of completed downloads and available updates.
-
Star button. The new star button in the location bar lets you quickly add a new bookmark with a single click. A second click lets you file and tag your new bookmark.
-
Tags. You can now associate keywords with your bookmarks to easily sort them by topic.
-
Location bar and auto-complete. Type the title or tag of a page in the location bar to quickly find the site you were looking for in your history and bookmarks. Favicons, bookmark, and tag indicators help you see where the results are coming from.
-
Smart Bookmarks folder. Firefox's new Smart Bookmarks folder offers quick access to your recently bookmarked and tagged places, as well as pages you visit frequently.
-
Bookmarks and History Organizer. The new unified bookmarks and history organizer lets you easily search your history and bookmarks with multiple views and smart folders for saving your frequent searches.
-
Web-based protocol handlers. Web applications, such as your favorite web mail provider, can now be used instead of desktop applications for handling
mailto:
links from other sites. Similar support is provided for other protocols as well. (Note that web applications do have to register themselves with Firefox before this will work.) -
Easy to use Download Actions. A new Applications preferences pane provides an improved user interface for configuring handlers for various file types and protocol schemes.
-
Improved look and feel. Graphics and font handling have been improved to make web sites look better on your screen, including sharper text rendering and better support for fonts with ligatures and complex scripts. In addition, Mac and Linux (Gnome) users will find that Firefox feels more like a native application for their platform than ever, with a new, native, look and feel.
-
Color management support. By setting the
gfx.color_management.enabled
preference in [about:config]
, you can ask Firefox to use the color profiles embedded in images to adjust the colors to match your computer's display. -
Offline support. Web applications can take advantage of new features to support being used even when you don't have an Internet connection.
Security and privacy
-
One-click site information. Want to know more about the site you're visiting? Click the site's icon in the location bar to see who owns it. Identify information is prominently displayed and easier than ever to understand.
-
Malware protection. Firefox 3 warns you if you arrive at a web site that is known to install viruses, spyware, trojans, or other dangerous software (known as malware). You can see what the warning looks like by clicking here.
-
Web forgery protection enhanced. Now when you visit a page that's suspected of being a forgery, you're shown a special page instead of the contents of the page with a warning. Click here to see what it looks like.
-
Easier to understand SSL errors. The errors presented when an invalid SSL certificate is encountered have been clarified to make it easier to understand what the problem is.
-
Out-of-date add-on protection. Firefox 3 now automatically checks add-on and plugin versions and disables older, insecure versions.
-
Secure add-on updates. Add-on update security has been improved by disallowing add-ons that use an insecure update mechanism.
-
Anti-virus integration. Firefox 3 now informs anti-virus software when executable files are downloaded.
-
Windows Vista parental controls support. Firefox 3 supports the Vista system-wide parental control setting for disabling file downloads.
Performance
-
Reliability. Firefox 3 now stores bookmarks, history, cookies, and preferences in a transactionally secure database format. This means your data is protected against loss even if your system crashes.
-
Speed. Firefox 3 has gotten a performance boost by completely replacing the part of the software that handles drawing to your screen, as well as to how page layout work is handled.
-
Memory use reduced. Firefox 3 is more memory efficient than ever, with over 300 memory "leak" bugs fixed and new features to help automatically locate and dispose of leaked memory blocks.
« CSS « CSS Reference
Summary
The float
CSS property specifies that an element should be taken from the normal flow and placed along the left or right side of its container, where text and inline elements will wrap around it.
A floating element is one where the Computed value
of float
is not none
.
Syntax
float: left | right | none |
inherit
Values
- left
- The element floats on the left side of its containing block.
- right
- The element floats on the right side of its containing block.
- none
- The element does not float.
Examples
View Live Examples
<style type="text/css">
div { border: solid red; max-width: 70ex; }
h4 { float: left; margin: 0; }
</style>
<div>
<h4>HELLO!</h4>
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
</div>
HELLO!
This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text.
Notes
Note that if you're referring to this property from JavaScript as a member of the element.style object, you must spell it at cssFloat
(see the list at DOM:CSS). Also note that IE spells this styleFloat
.
How floats are positioned
As mentioned above, when an element is floated it is taken out of the normal flow of the document. It is shifted to the left or right until it touches the edge of it's containing box or another floated element.
In the image below, there are three red squares. Two are floated left and one is floated right. Note that the second "left" red square is placed to the right of the first. Additional squares would continue to stack to the right until they filled the containing box, after which they would wrap to the next line.

Clearing floats
In the example above, the floated elements are shorter vertically than the block of text they're floated within. However, if the text was not long enough to wrap below the bottom of all the floats, we might see unanticipated effects. If the paragraph above, for instance, only read "Lorem ipsum dolor sit amet," and was followed by another heading of the same style as the "Floats Example" heading, the second heading would appear between the red boxes. Most likely, we want the next heading to be aligned all the way to the left. To accomplish that, we'd need to clear the floats.
The simplest way to clear the floats in this example is to add the
clear
property to the new heading we want to be sure is aligned left:
h2.secondHeading { clear: both; }
However, this method only works if there are no other elements within the same block formatting context that we do want the heading to continue to appear next to horizontally. If our H2
has siblings which are a sidebars floated to the left and right, using clear
will force it to appear below both sidebars, which is probably not what we want.
If clearing floats on an element below them is not an option, another approach is to limit the block formatting context of the floats' container. Referring to the example above again, it appears that all three red boxes are within a P
element. We can set the
overflow
property on that P to hidden
or auto
to cause it to expand to contain them, but not allow them to drop out the bottom of it:
p.withRedBoxes { overflow: hidden; height: auto; }
Note: Setting overflow
to scroll
will also contain any floated child elements, but will show scrollbars no matter the height of the content. Here we're setting height
to auto
even though that's the default to indicate that the container should grow to accommodate its content.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 4.0 | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The font-family
CSS property allows for a prioritized list of font family names and/or generic family names to be specified for the selected element. Unlike most other CSS properties, values are separated by a comma to indicate that they are alternatives.
It is often convenient to use the shorthand property
font
to set font-size
and other font related properties at one go.
Syntax
font-family: <family-or-generic-name> [, <family-or-generic-name>]* |
inherit
Values
<family-or-generic-name> is either a family-name or a generic-family.
- family-name
- The name of a font family. For example, "Times" and "Helvetica" are font families. Font family names containing whitespace should be quoted.
- generic-family
- Generic font families are a fallback mechanism, a means of preserving some of the style sheet author's intent in case when none of the specified fonts are available. Generic family names are keywords and must not be quoted. A generic font family should be the a last alternative in the list of font family names.
serif
- Glyphs have finishing strokes, flared or tapering ends, or have actual serifed endings.
E.g. Palatino, "Palatino Linotype", Palladio, "URW Palladio", serif sans-serif
- Glyphs have stroke endings that are plain.
E.g. 'Trebuchet MS', 'Liberation Sans', 'Nimbus Sans L', sans-serif cursive
- Glyphs in cursive fonts generally have either joining strokes or other cursive characteristics beyond those of italic typefaces. The glyphs are partially or completely connected, and the result looks more like handwritten pen or brush writing than printed letterwork.
fantasy
- Fantasy fonts are primarily decorative fonts that contain playful representations of characters.
monospace
- All glyphs have the same fixed width.
E.g. "DejaVu Sans Mono", Menlo, Consolas, "Liberation Mono", Monaco, "Lucida Console", monospace
Examples
View Live Examples
body { font-family: "Gill Sans Extrabold", Helvetica, sans-serif }
.receipt { font-family: Courier, "Lucida Console", monospace }
Notes
You should always specify a generic family name as the last value in the font-family
property.
The font-family
property specifies a list of fonts, from highest priority to lowest. Font selection does not simply stop at the first font named in the list that is on the user's system. Rather, font selection is done one character at a time, so that if an available font does not have a glyph that can display a character needed, the later available fonts are tried. However, this doesn't work in Internet Explorer.
When a font is only available in some styles, variants, or sizes, those properties may also influence which font family is chosen.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 3.0 | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Values
Using the font
shorthand property sets the longhand properties as specified, and sets all other font-related properties to their initial values. See
font-style
,
font-variant
,
font-weight
,
font-size
,
line-height
, and
font-family
for legal values of each property.
System Fonts
System fonts can also be specified using the font
property, instead of specifying individual longhand properties:
- caption
- The font used for captioned controls (e.g., buttons, drop-downs, etc.).
- icon
- The font used to label icons.
- menu
- The font used in menus (e.g., dropdown menus and menu lists).
- message-box
- The font used in dialog boxes.
- small-caption
- The font used for labeling small controls.
- status-bar
- The font used in window status bars.
Mozilla Extensions
- -moz-window
- The default system font used in windows.
- -moz-document
- -moz-workspace
- -moz-desktop
- -moz-info
- -moz-dialog
- -moz-button
- -moz-pull-down-menu
- -moz-list
- -moz-field
Examples
View Live Examples
/* Set the font size to 12px and the line height to 14px. Set the font family to sans-serif */
p { font: 12px/14px sans-serif }
/* Set the font size to 80% of the parent element or default value (if no parent element present)
and set the font family to sans-serif */
p { font: 80% sans-serif }
/* Set the font weight to bold, the font-style to italic, the font size to large,
and the font family to serif. */
p { font: bold italic large serif }
/* Use the same font as the status bar of the window */
p { font: status-bar }
Notes
The
font-size
and
font-family
parts of the shorthand are mandatory. Omitting them is a syntax error, and causes the entire declaration to be ignored.
Properties for which no values are given are set to their initial value, which is normal
for all properties that can be omitted (
font-style
,
font-variant
,
font-weight
, and
line-height
).
The
font-size-adjust
property is also set to its initial value (none
) when the
font
shorthand property is specified.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Shorthand | 1.0 | 1.0 (1.0) | 3.0-4.0 | 3.5 | 1.0 (85) |
System fonts | 1.0 | 1.0 (1.0) | 4.0-5.5 | 6.0 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The font-size-adjust
CSS property specifies that font size should be chosen based on the height of lowercase letters rather than the height of capital letters.
This is useful since the legibility of fonts, especially at small sizes, is determined more by the size of lowercase letters than by the size of capital letters. This can cause problems when the first-choice
font-family
is unavailable and its replacement has a significantly different aspect ratio (the ratio of the size of lowercase letters to the size of the font).
To do this in a way that is compatible with browsers that do not support font-size-adjust
, it is specified as a number that the
font-size
property is multiplied by. This means the value specified for the property should generally be the aspect ratio of the first choice font. For example, a style sheet that specifies
font-size: 16px; font-size-adjust: 0.5;
is really specifying that the lowercase letters of the font should be 8px
high (0.5 × 16px).
Syntax
font-size-adjust: <number> | none |
inherit
Values
- none
- Choose the size of the font based only on the
font-size
property. - <number>
-
Choose the size of the font so that its lowercase letters (as determined by the x-height metric of the font) are the specified number times the
font-size
.
The number specified should generally be the aspect ratio (ratio of x-height to font size) of the first choice
font-family
. This will mean that the first choice font, when available, will appear the same size in browsers, whether or not they support font-size-adjust
.
Examples
View Live Examples
p {
font: 12px Verdana, "DejaVu Sans", sans-serif;
font-size-adjust: 0.58;
}
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
-- | 1.0 (1.0) Windows only |
-- |
-- |
-- |
3.0 (1.9)
All platforms |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | 1.0 (1.9.2)
| ? | ? | ? |
Specifications
This property was specified in CSS 2, but removed from CSS 2.1. It may come back in CSS 3.
« CSS « CSS Reference
Summary
The font-size property specifies the size of the font. The font size may, in turn, change the size of other items, since it is used to compute the value of em
and ex
length units.
Syntax
font-size: xx-small | x-small | small | medium | large | x-large | xx-large
font-size: smaller | larger
font-size: <length> | <percentage> |
inherit
Values
-
xx-small
, x-small
, small
, medium
, large
, x-large
, xx-large
- A set of absolute size keywords based on the user's default font size (which is
medium
). Similar to presentational HTML's <font size="1">
through <font size="7">
where the user's default font size is <font size="3">
. -
larger
, smaller
- Larger or smaller than the parent element's font size, by roughly the ratio used to separate the absolute size keywords above.
- length
- A positive length. When the units are specified in
em
or ex
, the size is defined relative to the size of the font on the parent element of the element in question. For example, 0.5em is half the font size of the parent of the current element. - percentage
- A positive percentage of the parent element's font size.
It is best to avoid using values that are not relative to the user's default font size, such as lengths with units other than em
or ex
. However, if such values must be used, px
are preferred over other units because their meaning does not vary depending on what the operating system thinks (generally incorrectly) the resolution of the monitor is.
Possible approaches
There are several ways to specify the font size, with keywords or numerical values for pixels or ems. Choose the appropriate method based on the needs for the particular web page.
Keywords
Keywords are a good way to set the size of fonts on the web. By setting a keyword font size on the body element, you can set relative font-sizing everywhere else on the page, giving you the ability to easily scale the font up or down on the entire page accordingly.
Pixels
Setting the font size in pixel values (px
) is a good choice when you need pixel accuracy. A px value is static. This is an OS-independent and cross-browser way of literally telling the browsers to render the letters at exactly the number of pixels in height that you specified. The results may vary slightly across browsers, as they may use different algorithms to achieve a similar effect.
Font sizing settings can also be used in combination. For example, if a parent element is set to 16px
and its child element is set to larger
, the child element displays larger than the parent element in the page.
Note: Defining font sizes in pixel is not accessible, because the user cannot change the font size from the browser. (For example, users with limited vision may wish to set the font size much larger than the size chosen by a web designer.) Therefore, avoid using pixels for font sizes if you wish to create an inclusive design.
Ems
Another way of setting the font size is with em
values. The size of an em
value is dynamic. When defining the font-size
property, an em is equal to the size of the font that applies to the parent of the element in question. If you haven't set the font size anywhere on the page, then it is the browser default, which is probably 16px. So, by default 1em = 16px, and 2em = 32px. If you set a font-size
of 20px on the body element, then 1em = 20px and 2em = 40px. Note that the value 2 is essentially a multiplier of the current em size.
In order to calculate the em equivalent for any pixel value required, you can use this formula:
em = desired element pixel value / parent element font-size in pixels
For example, suppose the font-size of the body of the page is set to 1em, with the browser standard of 1em = 16px; if the font-size you want is 12px, then you should specify 0.75em (because 12/16 = 0.75). Similarly, if you want a font size of 10px, then specify 0.625em (10/16 = 0.625); for 22px, specify 1.375em (22/16).
A popular technique to use throughout the document is to set the the font-size of the body to 62.5% (that is 62.5% of the default of 16px), which equates to 10px, or 0.625em. Now you can set the font-size for any elements using em units, with an easy-to-remember conversion, by dividing the px value by 10. This way 6px = 0.6em, 8px = 0.8em, 12px = 1.2em, 14px = 1.4em, 16px = 1.6em. For example:
body {
font-size: 62.5%; /* font-size 1em = 10px */
}
p {
font-size: 1.6em; /* 1.6em = 16px */
}
The em is a very useful unit in CSS, since it can adapt automatically to the font that the reader chooses to use.
Examples
View Live Examples
/* Set paragraph text to be very large. */
p { font-size: xx-large }
/* Set h1 (level 1 heading) text to be 2.5 times the size
* of the text around it. */
h1 { font-size: 250% }
/* Sets text enclosed within span tag to be 16px */
span { font-size: 16px; }
Notes
em
and ex
units on the
font-size
property are relative to the parent element's font size (unlike all other properties, where they're relative to the font size on the element). This means em
units and percentages do the same thing for
font-size
.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 2.0 | 1.0 | 5.5 | 9.2 | 1.3 |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The font-stretch
CSS property selects a normal, condensed, or extended face from a font family.
Syntax
font-stretch: inherit |
ultra-condensed | extra-condensed | condensed | semi-condensed |
normal | semi-expanded | expanded | extra-expanded | ultra-expanded |
wider | narrower
Values
- normal
- Specifies a normal font face.
- semi-condensed, condensed, extra-condensed, ultra-condensed
- Specifies a font face condensed than normal, with ultra-condensed as the most condensed.
- semi-expanded, expanded, extra-expanded, ultra-expanded
- Specifies a font face expanded than normal, with ultra-expanded as the most expanded.
- wider, narrower
Deprecated since CSS 3
- Relative values. The
wider
and narrower
keywords indicate values relative to the values of the parent element.
Examples
h1 { font-stretch: extra-expanded }
p { font-stretch: condensed }
Specifications
font-stretch
was defined in CSS 2, but dropped in CSS 2.1 due lack of implementation experience. It's newly drafted in CSS 3.
The relative values wider
and narrower
have been dropped from the font-stretch
property in the CSS Fonts Module Level 3 Working Draft (24 March 2011).
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | -- | 9.0 (9.0)
[1] [*] | 9.0 [*] | ? | -- |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | -- | 9.0 (9.0)
[2] [*] | ? | ? | -- |
[*] Implements the CSS Fonts Module Level 3 specification. Hence do not support the deprecated wider and narrower keywords.
« CSS « CSS Reference
Summary
The font-style
CSS property allows italic
or oblique
faces to be selected within a
font-family
.
Syntax
font-style: normal | italic | oblique |
inherit
Values
Italic forms are generally cursive in nature while oblique faces are typically sloped versions of the regular face. Oblique faces can be simulated by artificially sloping the glyphs of the regular face.
- normal
- selects a font that is classified as
normal
within a
font-family
- italic
- selects a font that is labeled
italic
, if that is not available, one labeled oblique
- oblique
- selects a font that is labeled
oblique
Example
This paragraph is italic.
This paragraph is oblique.
The above example shows the two font-style
values. The CSS looks like this:
p.italic { font-style:italic }
p.oblique { font-style: oblique }
And the HTML looks like this:
<p class="italic">This paragraph is italic.</p>
<p class="oblique">This paragraph is oblique.</p>
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 1.0 | 1.0 (1.7 or earlier)
| 1.0 | 1.0 | 3.5 | 1.0 |
Feature | Firefox Mobile (Gecko) | Android | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | 1.0 (1.9.2)
| ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The font-variant
CSS property selects a normal
, or small-caps
face from a font family. Setting font-variant
is also possible by using the
font
shorthand.
Syntax
font-variant: normal | small-caps |
inherit
Values
- normal
- Specifies a normal font face.
- small-caps
- Specifies a font that is labeled as a small-caps font. If a small-caps font is not available, Mozilla (Firefox) and other browsers will simulate a small-caps font, i.e. by taking a normal font and replacing the lowercase letters by scaled uppercase characters.
Examples
p { font-variant: small-caps }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 4.0 | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The
font-weight
property specifies the weight or boldness of the font. However, some fonts are not available in all weights; some are available only on normal
and bold
.
Syntax
font-weight:
normal
| bold
| bolder
| lighter
| 100
| 200
| 300
| 400
| 500
| 600
| 700
| 800
| 900
|
inherit
Values
- normal
- Normal font weight. Same as
400
. - bold
- Bold font weight. Same as
700
. - lighter
- One font weight lighter than the parent element (among the available weights of the font).
- bolder
- One font weight darker than the parent element (among the available weights of the font).
- 100, 200, 300, 400, 500, 600, 700, 800, 900
- Numeric font weights for fonts that provide more than just normal and bold. If the exact weight given is unavailable, then
600
-900
use the closest available darker weight (or, if there is none, the closest available lighter weight), and 100
-500
use the closest available lighter weight (or, if there is none, the closest available darker weight). This means that for fonts that provide only normal
and bold
, 100
-500
are normal, and 600
-900
are bold.
Examples
View Live Examples
/* Set paragraph text to be bold. */
p {font-weight: bold}
/* Set h1 (level 1 heading) text to one step darker than
normal but less than a standard bold. */
h1 {font-weight: 500}
/* Sets text enclosed within span tag to be one step lighter
than the parent. */
span {font-weight: lighter}
Notes
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 2.0 | 1.0 (1.7 or earlier)
| 3.0 | 3.5 | 1.3 |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 1.0 | 1.0 (1)
| 6.0 | 6.0 | 3.1 |
« CSS « CSS Reference
Summary
The <frequency>
CSS data types denotes a frequency dimension, like the pitch of a speaking voice. They consists of a
<number>
immediately followed by the unit. Like for any CSS dimension, there is no space between the unit literal and the number.
The following units may be used :
-
Hz
which represents a frequency in Hertz. E.g. 0Hz
, 1500Hz
, 10000Hz
. -
kHz
which represents a time in kilohertz. E.g. 0kHz
, 1.5kHz
, 10kHz
.
As all units represents the same time for the value 0, the unit may be omitted in that case: 0
represents 0Hz
, 0kHz
. Though the units are case-insensitive in CSS, it is good practice to use a capital H for Hz
and kHz
, as in the SI, Hertz being a family noun.
Examples
These are valid time values:
12Hz Positive integer
-456kHz Negative integer
4.3Hz Non-integer
14KhZ The unit is case-insensitive, though non-SI capitalization is not recommended.
0 Zero (without the unit)
+0s Zero, with a leading + and the unit
-0ms Zero, with a leading - and the unt(Though strange, this is an allowed value)
These are invalid time values:
12.0 This is a <number>, not an <frequency>, it must have a unit
7 Hz No space is allowed between the <number> and the unit
Specifications
This data type was initially introduced in CSS Level 2 for the now obsoleted aural media group, where it was used to define the pitch of the voice. This has been deprecated since then, but the <frequency> data type has been reintroduced in CSS3, though no CSS property is using it at the moment.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | no | no | no [1]
| no [*] | no |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | no | no | no | no | no |
[*] Some versions of Opera may have (partial) support for the obsolete aural media group, and through the pitch property support for the <frequency>
data type.
See also
-
CSS Reference index
- CSS Data Types :
<angle>
, <color>
, <frequency>
, <identifier>
, <integer>
, <length>
, <number>
, <percentage>
, <ratio>
, <resolution>
, <shape>
, <string>
, <time>
, <timing-function>
, <uri>
« CSS « CSS Reference
Summary
The height
CSS property specifies the height of the content area of an element. The content area is inside the padding, border, and margin of the element.
Values
- <length>
- See
<length>
for possible units. - <percentage>
- The
<percentage>
is calculated with respect to the height of the containing block. If the height of the containing block is not specified explicitly, the value computes to auto
. A percentage height on the root element (e.g. <html>
) is relative to the viewport. - auto
- The browser will calculate and select a width for the specified element.
Examples
View Live Examples
table { height: 100%; }
img { height: 200px; }
form { height: auto; }
/* make sure percentage height of body's children works as expected */
html, body { margin: 0; height: 100%; }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 4.0 | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
This is an experimental feature
Because this feature is still in development in some browsers, check the compatibility table for the proper prefixes to use in various browsers.
Summary
The hyphens
property tells the browser how to go about splitting words to improve the layout of text when line-wrapping.
Note: The rules defining how hyphenation is performed are not explicitly defined by the specification, so the exact hyphenation may vary from browser to browser.
Syntax
hyphens: none | manual | auto
Values
none
- Words are not broken at line breaks, even if characters inside the words suggest line break points. Lines will only wrap at whitespace.
manual
- Words are broken for line-wrapping only where characters inside the word suggest line break opportunities. See Suggesting line break opportunities for details.
auto
- The browser is free to automatically break words at appropriate hyphenation points, following whatever rules it chooses to use. Suggested line break opportunities, as covered in Suggesting line break opportunities, should be preferred over automatically selecting break points whenever possible.
Note: The auto
setting's behavior depends on the language being properly tagged so that the appropriate hyphenation rules can be selected. You must specify a language using the lang
HTML attribute in order to guarantee that automatic hyphenation is applied in the language of your choice.
Suggesting line break opportunities
There are two Unicode character that can be used to manually specify potential line break points within text:
- U+2010 (HYPHEN)
- The "hard" hyphen character indicates a visible line break opportunity. Even if the line is not actually broken at that point, the hyphen is still rendered.
- U+00AD (SHY)
- An invisible, "soft" hyphen. This character is not rendered visibly; instead, it suggests a place where the browser might choose to break the word if necessary. In HTML, you can use
­
to insert a soft hyphen.
Example
This CSS snippet creates three classes, one for each possible configuration of the hyphens
property.
p.none {
-moz-hyphens: none;
hyphens: none;
}
p.manual {
-moz-hyphens: manual;
hyphens: manual;
}
p.auto {
-moz-hyphens: auto;
hyphens: auto;
}
Take a look at the live example to see these configurations in action; resize the window while looking at them to see how hyphenation is handled in your browser.
View the live example
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | ? | 6.0 (6.0)
-moz Automatic hyphenation only works for languages whose hyphenation dictionaries are integrated in Gecko. See this note for a complete list of such languages. | ? | ? | 5.1
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | ? | 6.0 (6.0)
-moz Automatic hyphenation only works for languages whose hyphenation dictionaries are integrated in Gecko. See this note for a complete list of such languages. | ? | ? | ? |
Gecko notes
Gecko (Firefox) supplies hyphenation dictionaries for the following languages:
- Afrikaans (af)
Requires Gecko 8.0
- Bulgarian (bg)
Requires Gecko 8.0
- Catalan (ca)
Requires Gecko 8.0
- Swiss German, Traditional Orthography (de-CH)
Requires Gecko 8.0
- Danish (da)
Requires Gecko 8.0
- Dutch (nl)
Requires Gecko 8.0
- English, United States (en-US)
Requires Gecko 6.0
- Esperanto (eo)
Requires Gecko 8.0
- Estonian (et)
Requires Gecko 8.0
- Finnish (fi)
Requires Gecko 8.0
- French (fr)
Requires Gecko 8.0
- Galician (gl)
Requires Gecko 9.0
- German, Traditional Orthography (de-1901)
Requires Gecko 8.0
- German, Reformed Orthography (de-1996)
Requires Gecko 8.0
- Hungarian (hu)
Requires Gecko 9.0
- Icelandic (is)
Requires Gecko 8.0
- Interlingua (ia)
Requires Gecko 8.0
- Italian (it)
Requires Gecko 9.0
- Kurmanji (kmr)
Requires Gecko 8.0
- Latin (la)
Requires Gecko 8.0
- Lithuanian (lt)
Requires Gecko 8.0
- Mongolian (mn)
Requires Gecko 8.0
- Norwegian Bokmål (nb)
Requires Gecko 8.0
- Norwegian Nynorsk (nn)
Requires Gecko 8.0
- Portuguese (pt)
Requires Gecko 8.0
- Russian (ru)
Requires Gecko 8.0
- Serbo-Croatian (sh)
Requires Gecko 8.0
- Slovenian (sl)
Requires Gecko 8.0
- Spanish (es)
Requires Gecko 8.0
- Swedish (sv)
Requires Gecko 8.0
- Turkish (tr)
Requires Gecko 9.0
- Ukrainian (uk)
Requires Gecko 9.0
- Upper Sorbian (hsb)
Requires Gecko 8.0
- Welsh (cy)
Requires Gecko 8.0
Summary
The <identifier>
CSS data value denotes an arbitrary user-defined string used as an identifier.
Its syntax is similar to the CSS identifier one, except that it is case-sensitive: an <identifier>
is a sequence of characters where characters can be :
- any alphanumeric character (A to Z, or a to z),
- any decimal digit (0 to 9),
- a dash ('
-
') - an underscore ('
_
'), - a escaped character (with a backslash, '
\
'), - or a Unicode character (in the format of a backslash followed by one to six hexadecimal digits, its Unicode code point).
The first character must not be a decimal digit nor a dash ('-
') followed by a decimal digit or another dash. An <identifier>
must not be placed between single or double quotes as it would be identical to a
<string>
.
Note that id1
, Id1
, iD1
and ID1
are all different identifiers as they are case-sensitive. In the opposite, as they are several way to escape a character, toto\?
and toto\3F
are the same identifiers.
These are valid identifiers:
nono79 A mix of alphanumeric characters and numbers
ground-level A mix of alphanumeric characters and a dash
-test A dash followed by an alphabetic character
_internal An underscore followed by alphanumeric characters
\22 toto A Unicode character followed by a sequence of alphanumeric character
bili\.bob The period is correctly escaped
These are invalid identifiers:
34rem It must not start with a decimal digit.
-12rad It must not start with a dash followed by a decimal digit.
bili.bob Only alphanumeric characters, _ and - need not being escaped.
--toto It must not start with two dashes.
'bilibob' It isn't an <identifier>, it is a <string>.
"bilibob" It isn't an <identifier>, it is a <string>.
The <identifier>
data type is mainly used in conjunction with CSS Counters, the
counter
functional notation and the two related CSS properties,
counter-reset
and
counter-increment
.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 2.0 | 1.0 (?) | 8.0 [1]
| 9.2 | 3.1 (?) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
See also
-
CSS Reference index
- CSS Data Types :
<angle>
, <color>
, <frequency>
, <identifier>
, <integer>
, <length>
, <number>
, <percentage>
, <ratio>
, <resolution>
, <shape>
, <string>
, <time>
, <timing-function>
, <uri>
Summary
The image-rendering
property provides a hint to the user agent about how to handle its image rendering.
image-rendering
applies to scaled images (and other elements, see below). For example, if the natural size of the image is 100×100px but the page author specifies the dimensions to 200×200px (or 50×50px), then the image will be upscaled (or downscaled) to the new dimensions using the specified algorithm. Scaling may also apply due to user interaction (zooming).
Syntax
image-rendering: auto | inherit | optimizeSpeed | optimizeQuality | -moz-crisp-edges | -o-crisp-edges
Values
- auto
- Default value, depends on the user agent. Since version 1.9 (Firefox 3.0), Gecko uses bilinear resampling (high quality).
- optimizeQuality
- Indicates that the user agent shall emphasize quality over rendering speed. Gecko uses bilinear resampling (high quality).
- optimizeSpeed
- The user agent should use a resampling algorithm which achieves the goal of fast rendering. Currently Gecko (Firefox) uses nearest neighbor resampling (low quality).
-
-moz-crisp-edges | -o-crisp-edges
-
Mozilla extension. Gecko (Firefox) always uses nearest neighbor resampling (low quality). Use this value to avoid upscaled images with sharp edges getting blurry.
bug 423756
.
- -webkit-optimize-contrast
- WebKit extension (
WebKit bug 56627). WebKit uses a pixelation-generating resampling. The algorithm for now seems to be nearest-neighbor, but this can be WebKit-port specific, and there are other algorithms that can be used as well. Use this value to avoid upscaled images with sharp edges getting blurry.
Examples
img {
image-rendering: optimizeQuality; /* Firefox 3.6+; default behavior is identical, no need to specify */
-ms-interpolation-mode: bicubic; /* Internet Explorer 7.0; default in IE8+ */
}
/* applies to GIF and PNG images; avoids blurry edges */
img[src$=".gif"], img[src$=".png"] {
image-rendering: -moz-crisp-edges; /* Firefox */
-ms-interpolation-mode: nearest-neighbor
; /* IE */
}
html { image-rendering: -moz-crisp-edges; } /* all images, videos, background-images */
img { -ms-interpolation-mode: nearest-neighbor
; } /* all images, IE */
div {
background: url(chessboard.gif) no-repeat 50% 50%;
image-rendering: -moz-crisp-edges;
}
video { image-rendering: optimizeSpeed; }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | -- Note: Should get the landed -webkit-optimize-contrast WebKit patch soon.
| 3.6 (1.9.2)
image-rendering
| 7.0
-ms-interpolation-mode: bicubic | nearest-neighbor
- applies only to images (JPG, GIF, PNG, ...)
- in IE7 only for images without transparency
- does not inherit
- default value IE7:
nearest-neighbor (low quality) - default value IE8+:
bicubic (high quality)
| 11.60 image-rendering: auto | -o-crisp-edges | optimizeSpeed | optimizeQuality | 6533.21.1, r86920 image-rendering: auto | optimizeSpeed | optimizeQuality | -webkit-optimize-contrast
- -webkit-optimize-contrast is similar to -moz-crisp-edges, in that it selects the pixelation algorithm over the blurry algorithm for scaling. Pixelated scaling algorithm for now seems to be nearest-neighbor.
- -webkit-optimize-contrast implemented in the WebKit nightlies as of May 20th, 2011.
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
See also Microsoft MSDN -ms-interpolation-mode
property
Canvas can provide a fallback solution for crisp-edge/optimize-contrast through manual imageData manipulation.
Specifications
image-rendering
is an SVG property, it is not defined in any CSS standard. Gecko (Firefox)and Presto (Opera) apply it also to HTML and XML content.
SVG 1.1 Painting #image-rendering
« CSS « CSS Reference
Summary
The ime-mode
CSS property controls the state of the input method editor for text fields.
Syntax
ime-mode: auto | normal | active | inactive | disabled
Values
- auto
- No change is made to the current input method editor state. This is the default.
- normal
- The IME state should be normal; this value can be used in a user style sheet to override the page setting. This value is not supported by Internet Explorer.
- active
- The input method editor is initially active; text entry is performed using it unless the user specifically dismisses it. Not supported on Linux.
- inactive
- The input method editor is initially inactive, but the user may activate it if they wish. Not supported on Linux.
- disabled
- The input method editor is disabled and may not be activated by the user.
Examples
<input type="text" name="name" value="initial value" style="ime-mode: disabled">
This example disables input method support for a field; this might be necessary for fields that enter data into a database that doesn't support extended character sets, for example.
Notes
Unlike in Internet Explorer, the Firefox implementation of ime-mode
allows this property to apply to password editing fields. However, this does not make for an ideal user experience, and password fields should disable the IME. Users may correct the inappropriate behavior of sites that don't follow this recommendation by placing the following CSS into their user CSS file:
input[type=password] {
ime-mode: auto !important;
}
Note: In general, it's not appropriate for a public web site to manipulate the IME mode setting. This property should be used for web applications and the like.
The Macintosh version of Gecko 1.9 (Firefox 3) can't recover the previous state of the IME when a field for which it is disabled loses focus, so Mac users may get grumpy when you use the disabled
value.
Note: Don't rely on disabling IME to prevent extended characters from passing through your form. Even with IME disabled, users can still paste extended characters into your form's fields.
Specifications
It was introduced by Microsoft with IE5 as a proprietary extension.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | -- | 3.0 (1.9) | 5.0 | -- | -- |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
IE8 introduced -ms-ime-mode
as a synonym for ime-mode
. Don't use the -ms-
prefix.
« CSS « CSS Reference
Summary
The
inherit
value is allowed on every CSS property. It causes the element for which it is specified to take the Computed value
of the property from its parent element.
For inherited properties
For inherited properties, this reinforces the default behavior, and is only needed to override another rule. For example:
/* make second-level headers green */
h2 { color: green; }
/* ...but leave those in the sidebar alone so they use their parent's color */
#sidebar h2 { color: inherit; }
Note that in this example the h2
elements inside the sidebar might be different colors. For example, if one of them were the child of a div matched by the rule
div#current { color: blue; }
it would be blue.
For non-inherited properties
For non-inherited properties, this specifies a behavior that typically makes relatively little sense.
Notes
Inheritance is always from the parent element in the document tree, even when the parent element is not the containing block.
Browser Compatibility
Browser | Lowest Version |
Internet Explorer | 8.0 |
Firefox (Gecko) |
1.0 (1.0) |
Opera | 4.0-7.0 |
Safari (WebKit) |
1.0 (85) |
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
The -moz-initial
CSS keyword is a Mozilla implementation of CSS3 initial
. Applies the initial value of a property to an element.
-moz-initial
(initial
) is allowed on every CSS property. It causes the element for which it is specified to use the initial value of the property.
Examples
/* give headers a green border */
h2 { border: medium solid green }
/* but make those in the sidebar use the value of the "color" property */
#sidebar h2 { border-color: -moz-initial; border-color: initial; }
<p style="color:red">
this text is red
<em style="color:-moz-initial; color:initial">
this text is in the initial color (e.g. black)
</em>
this is red again
</p>
Browser compatibility
Browser | Lowest version | Support of |
Internet Explorer | --- | --- |
Firefox (Gecko) | 1.0-3.0 (1.0-1.9) [*] | -moz-initial |
Opera | --- | --- |
Safari (WebKit) |
1.2 (125) | initial |
[*] Increasing support in each version, almost complete in Firefox 3.0
« CSS « CSS Reference
Summary
The <integer>
CSS data type denotes an integer number, positive or negative. There isn't any associated unit with the value. An integer consists of one or several decimal digit, 0 to 9, eventually preceded by one single + or - sign.
Integers are used in numerous CSS properties, e. g.
z-index
,
line-height
,
counter-increment
,
-moz-column-count
.
Also any <integer>
CSS value is also a
<number>
CSS value, though the converse is not true.
Interpolation
Values of the <integer>
CSS data type can be interpolated in order to allow animations. In that case they are interpolated via integer discrete steps. The calculationis done as if they were real, floating-point, numbers and the discrete value is obtained using the floor function. [1] The speed of the interpolation is determined by the timing function associated with the animation.
Examples
These are valid integer values:
12 Positive integer (without a leading + sign)
+123 Positive integer (with a leading + sign)
-456 Negative integer
0 Zero
+0 Zero, with a leading +
-0 Zero, with a leading - (Though strange, this is an allowed value)
These are invalid integer values:
12.0 This is a <number>, not an <integer>, though it represents an integer
12. The dot should not be part of an <integer>
+---12 Only one leading +/- is allowed
ten Letters are not allowed
_5 Special characters are not allowed
\35 Escaped Unicode characters are not allowed, even if they are an integer (here: 5)
\4E94 Non-arabic numerals are not allowed, even escaped (here: the Japanese 5, 四)
Browser Compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
basic | 1.0 | 1.0 (1.0) | 3.0 | yes | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | yes | yes | yes | yes | yes |
See also
-
CSS Reference index
- CSS Data Types :
<angle>
, <color>
, <frequency>
, <identifier>
, <integer>
, <length>
, <number>
, <percentage>
, <ratio>
, <resolution>
, <shape>
, <string>
, <time>
, <timing-function>
, <uri>
« CSS « CSS Reference
Summary
The left
property specifies part of the position of positioned elements.
For absolutely positioned elements (those with
position
: absolute
or position: fixed
), it specifies the distance between the left margin edge of the element and the left edge of its containing block.
Syntax
left: <length> | <percentage> | auto | inherit ;
Values
-
<length>
- A length, can be negative, zero, or positive.
-
<percentage>
- A percentage of the containing block's width.
Examples
View the live example
#example_3 {
width: 600px;
height: 400px;
background-color: #FFC7E4;
position: relative;
top: 20px;
left: 20px;
}
#example_4 {
width:200px;
height:200px;
background-color: #FFD7C2;
position:absolute;
bottom:10px;
right: 20px;
}
Notes
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | 1.0 | 1.0 (1.7 or earlier)
| 5.5 | 5 | 1.0 |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
Summary
The <length>
CSS data type denotes distance measurements. It is a
<number>
immediately followed by a length unit (px
, em
, pc
, in
, mm
, ...). Like for any CSS dimension, there is no space between the unit literal and the number.
Many CSS properties take <length>
values, such as
width
,
margin
,
padding
,
font-size
,
border-width
,
text-shadow
, ...
For some properties, using negative lengths is a syntax error, but for some properties, negative lengths are allowed. Note also that some CSS properties accepted <length>
values also accepts
<percentage>
values; though also CSS dimensions, these are not <length>
values.
Interpolation
Values of the <length>
CSS data type can be interpolated in order to allow animations. In that case they are interpolated as real, floating-point, numbers. [1] The interpolation happens on the calculated value. The speed of the interpolation is determined by the timing function associated with the animation.
Units
Relative length units
Font-relative length
- em
- This unit represents the calculated
font-size
of the element. If used on the
font-size
property itself, it represents the inherited font-size of the element.
- ex
- This unit represents the x-height of the element's
font
. On fonts with the 'x' letter, this is generally the height of lowercase letters in the font; 1ex ≈ 0.5em
in many fonts. - ch Experimental
- This unit represents the width, or more precisely the advance measure, of the glyph '0' (zero, the Unicode character U+0030) in the element's
font
. - rem Experimental
- This unit represents the
font-size
of the root element (e.g. the font-size of the
<html>
element). When used on the
font-size
on this root element, it represents its initial value. This unit is practical in creating perfectly scalable layout. If not supported by the targeted browsers, such layout can be achieved using the em unit, though this is slightly more complex.
Viewport-relative length Experimental
- vh
- 1/100th of the height of the viewport.
- vw
- 1/100th of the width of the viewport.
- vm
- 1/100th of the minimum value between the height and the width of the viewport.
Absolute length units
Absolute length units represents a physical measurement and when the physical properties of the output medium are known, such as for print layout. This is done by anchored one of the unit to a physical unit and to defined the other relatively to it. The anchor is done differently for low-resolution devices, like screens, and high-resolution devices, like printers.
For low-dpi devices, the unit px represents the physical reference pixel and the other are defined relative to it. In that case, 1in
is defined as 96px
and 1pt
as 72px
. The consequence of this definition is that on such devices, length described in inches (in
), centimeters (cm
), millimeters (mm
) doesn't necessary match the length of the physical unit with the same name.
For high-dpi devices, inches (in
), centimeters (cm
), millimeters (mm
) are defined as their physical counterparts. Therefore the px unit is defined relative to them (1/96 of 1 inch).
- px
- Relative to the viewing device.
For screen display, typically one device pixel (dot) of the display.
For printers and very high resolution screens one CSS pixel implies multiple device pixels, so that the number of pixel per inch stays around 96. - mm
- One millimeter.
- cm
- One centimeter (10 millimeters).
- in
- One inch (2.54 centimeters).
- pt
- One point (which is 1/72 of an inch).
- pc
- One pica (which is 12 points).
- mozmm
Requires Gecko 2.0
Non-standard
- An experimental unit which attempts to render at exactly one millimeter regardless of the size or resolution of the display. This is rarely actually what you want, but may be useful in particular for mobile devices.
Requires Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
CSS units and dots-per-inch
Prior to Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
, Gecko attempted (often incorrectly) to actually compute the real size to render for these, even though most other rendering engines assumed 96 DPI. Now Gecko is consistent with the other browsers.
Starting in Gecko 2.0, changes to how CSS units translate to dots-per-inch (DPI) have been made to become consistent with the behavior of other popular browsers including Safari, Internet Explorer, and Google Chrome.
Some specific examples:
- 1in is now always 96px
- 3pt is now always 4px
- 25.4mm is now always 96px
In addition, Gecko has improved ability to correctly scale absolute lengths to the actual resolution of the rendering medium, whether that's the screen or paper.
Browser Compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1 | 1.0 (1.0) | 3.0 [2]
| 3.5 | 1.0 (85) |
ch | no | 1.0 (width of 'M') [*] 3.5 (correct) | 9 [3]
| no | no |
rem | 1 (528) [4]
| 3.6 (1.9.2) | 9 [5]
| no | 5.0 (533.17.8) |
vh, vw, vm | no [6]
| no [7]
| 9 [8]
| no | no [9]
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | yes | yes | yes | yes | yes |
ch | no | yes | ? | no | no |
rem | 2.1 | yes | ? | no | 4.0 |
vh, vw, vm | no | no | ? | no | no |
[*] Also, didn't work for
border-width
and
outline-width
CSS properties.
See also
-
CSS Reference index
- CSS Data Types :
<angle>
, <color>
, <frequency>
, <identifier>
, <integer>
, <length>
, <number>
, <percentage>
, <ratio>
, <resolution>
, <shape>
, <string>
, <time>
, <timing-function>
, <uri>
« CSS « CSS Reference
Summary
The letter-spacing
CSS property specifies spacing behavior between text characters.
Syntax
letter-spacing: normal | <length>
Values
- normal
- The spacing is the normal spacing for the current font. This value allows the user agent to alter the space between characters in order to justify text. That's the difference to the length value
0
. - <length>
- Indicates inter-character space in addition to the default space between characters. Values may be negative, but there may be implementation-specific limits. User agents may not further increase or decrease the inter-character space in order to justify text.
See
<length>
values for possible units.
Examples
Having a css style of:
p { letter-spacing: 0.4em }
and a webpage with the code:
<p> letter spacing </p>
will produce the following:
letter spacing
Here are some more letter spacing examples:
letter-spacing: 0.1em
letter-spacing: 0.5em
letter-spacing: 0.8em
letter-spacing: 1em
letter-spacing: -0.05em
letter-spacing: 6px
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
HTML support | 1.0 | 1.0 (1.7 or earlier)
| 4.0 | 3.5 | 1.0 (85) |
SVG support | (Supported) |
-- (
bug 371787
) | ? | (Supported) | (Supported) |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
HTML support | ? | ? | ? | ? | ? |
SVG support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
On inline elements, the line-height
CSS property specifies the height that is used in the calculation of the line box height.
On block level elements, line-height
specifies the minimal height of line boxes within the element.
Values
- normal
- Depends on the user agent. Desktop browsers (including Firefox) use a default value of roughly
1.2
, depending on the element's font-family
. - <number>
- The used value is this unitless
<number>
multiplied by the element's font size. The computed value is the same as the specified <number>
. In most cases this is is the preferred way to set line-height
with no unexpected results in case of inheritance. - <length>
- The specified
<length>
is used in the calculation of the line box height. See
<length>
values for possible units. - <percentage>
- Relative to the font size of the element itself. The computed value is this percentage multiplied by the element's computed font size.
Percentage and em values may have unexpected results, see "Notes" section.
Examples
/* All rules below have the same resultant line height */
div { line-height: 1.2; font-size: 10pt } /* number */
div { line-height: 1.2em; font-size: 10pt } /* length */
div { line-height: 120%; font-size: 10pt } /* percentage */
div { line-height: 12pt; font-size: 10pt } /* length */
div { font: 10pt/1.2 Georgia,"Bitstream Charter",serif }
Notes
- It is often more convenient to set
line-height
by using the
font
shortcut as stated in the "Examples" section above. - Prefer a unitless number:
<style>
.green { font-size: 15px; line-height: 1.1; border: solid limegreen; }
.red { font-size: 15px; line-height: 1.1em; border: solid red; }
h1 { font-size: 30px; }
div { width: 19em; display: inline-block; }
</style>
<div class=green>
<h1>Avoid unexpected results by using unitless line-height</h1>
length and percentage line-heights have poor inheritance behavior ...
</div>
<div class=red>
<h1>Avoid unexpected results by using unitless line-height</h1>
length and percentage line-heights have poor inheritance behavior ...
</div>
<!-- The first <h1> line-height is calculated from its own font-size (30px × 1.1) = 33px -->
<!-- The second <h1> line-height results from the red div's font-size (15px × 1.1) = 16.5px, probably not what you want -->
Avoid unexpected results, use unitless line-height!
em
values and <percentage>
line-heights have poor inheritance behavior, and should almost never be used in practice. Stick to unitless line-heights (such as "1.1
").
Avoid unexpected results, use unitless line-height!
em
values and <percentage>
line-heights have poor inheritance behavior, and should almost never be used in practice. Stick to unitless line-heights (such as "1.1
").
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 4.0 | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Syntax
list-style: list-style-type || list-style-position || list-style-image
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 4.0 | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The list-style-image
CSS property sets the image that will be used as the list item marker. It is often more convenient to use the shortcut
list-style
.
Syntax
list-style-image:
<uri>
| none | inherit
Values
- <uri>
- Location of image to use as the marker.
- none
- Default value
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 4.0 | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The list-style-position
CSS property specifies the position of the marker box in the principal block box. It is often more convenient to use the shortcut
list-style
.
Syntax
list-style-position: inside | outside | inherit
Values
- outside
- The marker box is outside the principal block box.
- inside
- The marker box is the first inline box in the principal block box, after which the element's content flows.
Examples
View the live example
<ul>
<li>Lorem ipsum <br> dolor sit amet <br> consectetuer</li>
<li>sed diam nonummy <br> nibh euismod tincidunt <br> ut laoreet</li>
</ul>
ul {list-style:square; background:gold}
- Lorem ipsum
dolor sit amet
consectetuer - sed diam nonummy
nibh euismod tincidunt
ut laoreet
ul {list-style:square inside; background:gold}
- Lorem ipsum
dolor sit amet
consectetuer - sed diam nonummy
nibh euismod tincidunt
ut laoreet
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 4.0 | 3.5 | 10. (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The list-style-type
CSS property specifies appearance of a list item element. As it is the only one who defaults to display:list-item
, this is usually a
<li>
element, but can be any element with this
display
value.
The color of the marker will be the same as the computed color of the element it applies to.
Syntax
list-style-type: <list-style-type> | none | inherit
Values
- none
- No item marker is shown.
<list-style-type> is one of the following:
- disc
-
- A filled circle (default value)
- circle
-
- square
-
- decimal
-
- Decimal numbers
- Beginning with 1.
- decimal-leading-zero
-
- Decimal numbers
- Padded by initial zeros
- (e.g., 01, 02, 03, ... 98, 99)
- lower-roman
-
- Lowercase roman numerals
- (i, ii, iii, iv, v, etc.)
- upper-roman
-
- Uppercase roman numerals
- (I, II, III, IV, V, etc.)
- lower-greek
-
- Lowercase classical Greek
- alpha, beta, gamma, ...
- (α, β, γ, ...)
- lower-alpha | lower-latin
-
- Lowercase ASCII letters
- (a, b, c, ... z)
-
lower-latin
is unsupported in IE7 - See Browser compatibility section
- upper-alpha | upper-latin
-
- Uppercase ASCII letters
- (A, B, C, ... Z)
-
upper-latin
is unsupported in IE7
- armenian
-
- Traditional Armenian numbering
- (ayb/ayp, ben/pen, gim/keem, ...)
- georgian
-
- Traditional Georgian numbering
- (an, ban, gan, ... he, tan, in ...)
CSS2 values, dropped in CSS 2.1, but supported in Gecko/Firefox and other browsers
- hebrew
-
- Traditional Hebrew numbering
- cjk-ideographic
-
- Plain ideographic numbers
- (Chinese-Japanese-Korean)
- hiragana
-
- a, i, u, e, o, ka, ki, ...
- (Japanese)
- katakana
-
- A, I, U, E, O, KA, KI, ...
- (Japanese)
- hiragana-iroha
-
- i, ro, ha, ni, ho, he, to, ...
- katakana-iroha
-
- I, RO, HA, NI, HO, HE, TO, ...
Mozilla extensions
Extended set of values provided by Mozilla (Firefox) to support list types in other languages.
- -moz-arabic-indic
-
- -moz-bengali
-
- -moz-cjk-earthly-branch
-
- -moz-cjk-heavenly-stem
-
- -moz-devanagari
-
- -moz-ethiopic-halehame
-
- -moz-ethiopic-halehame-am
-
- -moz-ethiopic-halehame-ti-er
-
- -moz-ethiopic-halehame-ti-et
-
- -moz-ethiopic-numeric
-
- -moz-gujarati
-
- -moz-gurmukhi
-
- -moz-hangul
-
- -moz-hangul-consonant
-
- -moz-japanese-formal
-
- -moz-japanese-informal
-
- -moz-kannada
-
- -moz-khmer
-
- -moz-lao
-
- -moz-malayalam
-
- -moz-myanmar
-
- -moz-oriya
-
- -moz-persian
-
- -moz-simp-chinese-formal
-
- -moz-simp-chinese-informal
-
- -moz-tamil
-
- -moz-telugu
-
- -moz-thai
-
- -moz-trad-chinese-formal
-
- -moz-trad-chinese-informal
-
- -moz-urdu
-
Examples
View the live example
ol { list-style-type: upper-alpha; }
/* or use the shortcut "list-style": */
ol { list-style: upper-alpha; }
Notes
- Some list-style-types require a suitable font installed to display as expected.
- The CSS specification does not define how alphabetic systems wrap at the end of the alphabet. For instance, after 26 list items,
upper-alpha
rendering is undefined. Firefox and other browsers will continue as AA, AB, AC,... For long lists, it is recommended that authors specify true numbers. - The list styles
hebrew, cjk-ideographs, hiragana, katakana, hiragana-iroha
and katakana-iroha
are specified in CSS2 and removed from CSS 2.1 due to lack of implementation experience. They are expected to return in the CSS3 Lists module.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support including :
none , disc , circle , square , decimal , lower-alpha , upper-alpha , lower-roman , upper-roman
| 1.0 | 1.0 (1.0) | 4.0 | 3.5 | 1.0 (85) |
lower-latin , upper-latin , lower-greek , armenian , georgian
| 1.0 | 1.0 (1.0) | 8.0 | 6.0 | 1.0 (85) |
decimal-leading-zero | 1.0 | 1.0 (1.0) | 8.0 | 8.0 | 1.0 (85) |
hebrew , cjk-ideographic , hiragana , hiragana-iroha , katakana , katakana-iroha
| 1.0 | 1.0 (1.0) | -- | 7.0 (displays decimal numbers) | 1.0-1.2 (85-125) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
For compatibility with Internet Explorer 7 (and lower) avoid lower-latin
and upper-latin.
Instead, use
lower-alpha
and upper-alpha
.
« CSS « CSS Reference
Summary
The margin-bottom
property of an element sets the margin space required on the bottom of an element. A negative value is also allowed.
-
Initial value
: 0
- Applies to: all elements except those with table display types other than
table-caption
, table
, and inline-table
-
Inherited
: no
- Percentages: refer to
width
of closest block-level ancestor - Media:
visual
-
Computed value
: the percentage as specified or the absolute length
Values
- <length>
- Specifies a fixed width. See
<length>
for possible values. - <percentage>
- A
<percentage>
always relative to the width of the containing block. - auto
- See
margin
.
Examples
.content { margin-bottom: 5%; }
.sidebox { margin-bottom: 10px; }
.logo { margin-bottom: -5px; }
#header { margin-bottom: 1em; }
View on jsFiddle
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 3.0 | 3.5 | 1.0 (85) |
auto value | 1.0 | 1.0 (1.0) | 6.0 (strict mode) | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The margin
CSS property sets the margin for all four sides. It is a shorthand to avoid setting each side separately with the other margin properties:
margin-top
,
margin-right
,
margin-bottom
and
margin-left
.
Negative value are also allowed.
-
Initial value
:
0
- Applies to: all elements except those with table display types other than
table-caption
, table
, and inline-table
-
Inherited
: no
- Percentages: refer always to the width of the containing block
- Media:
visual
-
Computed value
: the percentage as specified or the absolute length
Values
Accepts one, two, three or four values of the following:
- <length>
- Specifies a fixed width. Negative Values are allowed. See for
<length>
possible units. - <percentage>
- A
<percentage>
relative to the width of the containing block. Negative values are allowed. - auto
-
auto
is replaced by some suitable value, e.g. it can be used for centering of blocks.
div { width:50%; margin:0 auto; }
centers the div container horizontally.
-
One single value applies to all four sides.
-
Two values apply first to top and bottom, the second one to left and right.
-
Three values apply first to top, second to left and right and third to bottom.
-
Four values apply to top, right, bottom and left in that order (clockwise).
Examples
margin: 5%; /* all sides 5% margin */
margin: 10px; /* all sides 10px margin */
margin: 1.6em 20px; /* top and bottom 1.6em, left and right 20px margin */
margin: 10px 3% 1em; /* top 10px, left and right 3%, bottom 1em margin */
margin: 10px 3px 30px 5px; /* top 10px, right 3px, bottom 30px, left 5px margin */
margin: 1em auto; /* 1em margin on top and bottom, box is horizontally centered */
margin: auto; /* box is horizontally centered, 0 margin on top and bottom */
margin: auto;
background: gold;
width: 66%;
margin: -1em 0 100px -40px;
background: plum;
width: 20em
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 3.0 | 3.5 | 1.0 (85) |
auto value | 1.0 | 1.0 (1.0) | 6.0 (strict mode) | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The margin-left
property of an element sets the margin space required on the left side of an element. A negative value is also allowed.
-
Initial value
: 0
- Applies to: all elements except those with table display types other than
table-caption
, table
, and inline-table
-
Inherited
: no
- Percentages: refer to
width
of closest block-level ancestor - Media:
visual
-
Computed value
: the percentage as specified or the absolute length
Values
- <length>
- Specifies a fixed width. See
<length>
for possible values. - <percentage>
- A
<percentage>
always relative to the width of the containing block. - auto
- See
margin
.
Examples
.content { margin-left: 5%; }
.sidebox { margin-left: 10px; }
.logo { margin-left: -5px; }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 3.0 | 3.5 | 1.0 (85) |
auto value | 1.0 | 1.0 (1.0) | 6.0 (strict mode) | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The margin-right
property of an element sets the margin space required on the right side of an element. A negative value is also allowed.
-
Initial value
: 0
- Applies to: all elements except those with table display types other than
table-caption
, table
, and inline-table
-
Inherited
: no
- Percentages: refer to
width
of closest block-level ancestor - Media:
visual
-
Computed value
: the percentage as specified or the absolute length
Values
- <length>
- Specifies a fixed width. See
<length>
for possible values. - <percentage>
- A
<percentage>
always relative to the width of the containing block. - auto
- See
margin
.
Examples
.content { margin-right: 5%; }
.sidebox { margin-right: 10px; }
.logo { margin-right: -5px; }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 3.0 | 3.5 | 1.0 (85) |
auto value | 1.0 | 1.0 (1.0) | 6.0 (strict mode) | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The margin-top
CSS property of an element sets the margin space required on the top of an element. A negative value is also allowed.
-
Initial value
: 0
- Applies to:
inline
and block
elements, table
, inline-table
and table-caption
Elements -
Inherited
: no
- Percentages: refer always to width of the containing block
- Media:
visual
-
Computed value
: the percentage as specified or the absolute length
Values
- <length>
- Specifies a fixed width. See
<length>
for possible values. - <percentage>
- A
<percentage>
always relative to the width of the containing block. - auto
- See
margin
.
Examples
.content { margin-top: 5%; }
.sidebox { margin-top: 10px; }
.logo { margin-top: -5px; }
#footer { margin-top: 1em; }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 3.0 | 3.5 | 1.0 (85) |
auto value | 1.0 | 1.0 (1.0) | 6.0 (strict mode) | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Syntax
marker-offset: <value>
Examples
li:before { display: marker; marker-offset: 4px }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | ? | ? | ? | ? | ? |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
This property adds crop and/or cross marks to the presentation of the document. Crop marks indicate where the page should be cut. Cross marks are used to align sheets.
Crop marks and cross marks are printed outside the page box. To have room to show crop and cross marks, the final pages will have to be somewhat bigger than the page box.
Syntax
marks: [ crop || cross ] | none
Examples
@page { marks: crop cross; }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | ? | ? | ? | ? | ? |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The max-height
CSS property is used to set the maximum height of a given element. It prevents the used value of the
height
property from becoming larger than the value specified for max-height
.
Syntax
max-height: <length> | <percentage> | none | inherit
Values
- <length>
- A fixed maximum height. See
<length>
for possible units. - <percentage>
- The
<percentage>
is calculated with respect to the height of the containing block. If the height of the containing block is not specified explicitly, the percentage value is treated as none
. - none
- No limit on the height of the box.
Examples
View Live Examples (not available, please check later)
table { max-height: 75%; }
form { max-height: none; }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 7.0 | 4.0 | 2.0.2 (416) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The max-width
CSS property is used to set the maximum width of a given element. It prevents the used value of the
width
property from becoming larger than the value specified for max-width
.
Syntax
max-width: <length> | <percentage> | none | -moz-max-content | -moz-min-content | -moz-fit-content | -moz-available
Values
- none
- The width has no maximum value.
- length
- See
<length>
for possible units. - percentage
- Specified as a
<percentage>
of containing block's width.
Mozilla Extensions
- -moz-max-content
-
New in Firefox 3
The intrinsic preferred width.
- -moz-min-content
-
New in Firefox 3
The intrinsic minimum width.
- -moz-available
-
New in Firefox 3
The containing block width minus horizontal margin, border and padding.
- -moz-fit-content
-
New in Firefox 3
The same as
-moz-max-content.
Examples
body { max-width: 40em; }
table { max-width: 75%; }
form { max-width: none; }
p { background: gold }
The Mozilla community produces a lot of great software.
p { background: lightgreen;
max-width: intrinsic; /* Safari/WebKit */
max-width: -moz-max-content; /* Firefox/Gecko */
}
The Mozilla community produces a lot of great software.
p { background: lightblue; max-width: -moz-min-content; }
The Mozilla community produces a lot of great software.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 7.0 | 4.0 | 2.0.2 (416), buggy before |
applies to <table>
| no | yes | no | yes | no |
intrinsic width | 1.0 | 3.0 (1.9) | -- | -- | 2.0 (412) ? |
intrinsic
| -moz-max-content | intrinsic |
intrinsic minimum width | --
| 3.0 (1.9) | -- | -- | -- |
-moz-min-content |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The min-height
CSS property is used to set the minimum height of a given element. It prevents the used value of the
height
property from becoming smaller than the value specified for min-height
.
Syntax
min-height: <length> | <percentage> | inherit
Values
- <length>
- A fixed minimum height. See
<length>
for possible units. - <percentage>
- The
<percentage>
is calculated with respect to the height of the containing block. If the height of the containing block is not specified explicitly, the percentage value is treated as 0
.
Examples
View Live Examples (not available, please check later)
table { min-height: 75%; }
form { min-height: 0; }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 7.0 | 4.0 | 2.02 (416) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The min-width
CSS property is used to set the minimum width of a given element. It prevents the used value of the
width
property from becoming smaller than the value specified for min-width
.
Syntax
min-width: <length> | <percentage> | -moz-max-content | -moz-min-content | -moz-fit-content | -moz-available
Values
- length
- See
<length>
for possible units. - percentage
- Specified as a
<percentage>
of containing block's width.
Mozilla Extensions
- -moz-max-content
-
New in Firefox 3
The intrinsic preferred width.
- -moz-min-content
-
New in Firefox 3
The intrinsic minimum width.
- -moz-available
-
New in Firefox 3
The containing block width minus horizontal margin, border and padding.
- -moz-fit-content
-
New in Firefox 3
The same as
-moz-min-content.
Examples
table { min-width: 75%; }
form { min-width: 0; }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 7.0 | 4.0 | 2.0.2 (416), buggy before |
applies to <table>
| no | yes | no | yes | no |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Don't use this value! Use the cursor
value
alias
instead.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
The -moz-appearance
CSS property is used in Gecko (Firefox) to display an element using a platform-native styling based on the operating system's theme.
This property is frequently used in XUL stylesheets to design custom widgets with platform-appropriate styling. It is also used in the XBL implementations of the widgets that ship with the Mozilla platform.
Syntax
-moz-appearance: <appearance>
Values
<appearance>
is one of the following:
- none
- No special styling is applied. (Default)
- button
- The element is drawn like a button.
- checkbox
- The element is drawn like a checkbox, including only the actual "checkbox" portion.
- checkbox-container
- The element is drawn like a container for a checkbox, which may include a prelighting background effect under certain platforms. Normally a would contain a label and a checkbox.
- checkbox-small
Obsolete since Gecko 1.9.1
- dialog
- The element is styled like a dialog box, which includes background color and other properties.
- listbox
- menuitem
- The element is styled as menu item, item is highlighted when hovered.
- menulist
- menulist-button
- The element is styled as a button that would indicate a menulist can be opened.
- menulist-textfield
- The element is styled as the text field for a menulist. (Not implemented for the Windows platform)
- menupopup
- progressbar
- The element is styled like a progress bar.
- radio
- The element is drawn like a radio button, including only the actual "radio button" portion.
- radio-container
- The element is drawn like a container for a radio button, which may include a prelighting background effect under certain platforms. Normally would contain a label and a radio button.
- radio-small
Obsolete since Gecko 1.9.1
- resizer
- scrollbar
- scrollbarbutton-down
- scrollbarbutton-left
- scrollbarbutton-right
- scrollbarbutton-up
- scrollbartrack-horizontal
- scrollbartrack-vertical
- separator
- statusbar
- tab
- tab-left-edge
Obsolete
- tabpanels
- textfield
- textfield-multiline
- toolbar
- toolbarbutton
- toolbox
- -moz-mac-unified-toolbar
New in Firefox 3.5
- Mac OS X only. This causes the toolbar and title bar to render using the unified toolbar style common to Mac OS X 10.4 and later applications.
- -moz-win-borderless-glass
New in Firefox 4.0
- Used for Windows Vista and later. This style applies the Aero Glass effect -- but without a border -- to the element.
- -moz-win-browsertabbar-toolbox
New in Firefox 3
- Windows Vista and later. This toolbox style is meant to be used for the tab bar in a browser.
- -moz-win-communications-toolbox
New in Firefox 3
- Windows Vista and later. This toolbox style is meant to be used in communications and productivity applications. Corresponding foreground color is
-moz-win-communicationstext
. - -moz-win-glass
New in Firefox 3.5
- Windows Vista and later. This style applies the Aero Glass effect to the element.
- -moz-win-media-toolbox
New in Firefox 3
- Windows Vista and later. This toolbox style is meant to be used in applications that manage media objects. Corresponding foreground color is
-moz-win-mediatext
. - tooltip
- treeheadercell
- treeheadersortarrow
- treeitem
- treetwisty
- treetwistyopen
- treeview
- window
Examples
.exampleone {
-moz-appearance: toolbarbutton;
}
Browser compatibility
Browser | Lowest version | Support of |
Internet Explorer | --- | --- |
Firefox (Gecko) |
1.0 (1.0) | -moz-appearance |
Opera (Presto) | --- | --- |
Safari | Chrome | WebKit | 3.0 | 1.0 | 522 | -webkit-appearance |
« CSS « CSS Reference
Summary
The background-clip
CSS property specifies whether an element's background, either the color or image, extends underneath its border.
-moz-background-clip
is supported up to Gecko version 1.9.2 (Firefox 3.6). To support both, older and newer versions of Gecko (Firefox), you have to add both properties in the stylesheet (see examples).
If there is no background-image, this property has only visual effect when the border has transparent regions (because of
border-style
) or partially opaque regions; otherwise the border covers up the difference.
Syntax
background-clip: [ border-box | padding-box | content-box][, [ border-box | padding-box | content-box]]*
-moz-background-clip: [border | padding][, [border | padding]]* /* Gecko 1.2-1.9.2 (Firefox 1.0-3.6) */
Values
- border-box
Requires Gecko 2.0
border (Firefox 1.0-3.6)
- The background extends to the outside edge of the border (but underneath the border in z-ordering).
Default value, but see Browser compatibility section below for special case Internet Explorer 7. - padding-box
Requires Gecko 2.0
padding (Firefox 1.0-3.6)
- No background is drawn below the border (background extends to the outside edge of the padding).
- content-box
Requires Gecko 2.0
- The background is painted within (clipped to) the content box.
Examples
pre {
border: 5px navy;
border-style: dotted double;
background: #F8D575;
/* The yellow background will not go behind the border */
-moz-background-clip: padding; /* Firefox 1.0-3.6 */
-webkit-background-clip: padding-box; /* Safari, Chrome */
background-clip: padding-box; /* Firefox 4.0+, Opera 10.5, Chrome */
}
Browser compatibility
Browser | Lowest version | Support of |
Chrome | 1.0 | -webkit-background-clip: padding | border | content
-webkit-background-clip: padding-box | border-box | content-box |
1.0 | background-clip: padding-box | border-box background-clip: padding-box | border-box | content-box
|
Firefox (Gecko) | 1.0-3.6 (1.2-1.9.2) | -moz-background-clip: padding | border |
4.0 (2.0) | background-clip: padding-box | border-box | content-box
|
Internet Explorer | 9.0 [*] | background-clip: padding-box | border-box | content-box |
Opera | 10.5 | background-clip: padding-box | border-box |
Safari (WebKit) | 3.0 (522) |
-webkit-background-clip: padding | border | content
-webkit-background-clip: padding-box | border-box | content-box
|
- [*] IE 7 (not other versions of IE) behaves like
background-clip:padding
if overflow: hidden | auto | scroll
.
- Konqueror 3.5.4 supports
-khtml-background-clip
.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
In Gecko-based applications like Firefox, the -moz-background-inline-policy
CSS property specifies how the background image of an inline element is determined when the content of the inline element wraps onto multiple lines. The choice of position has significant effects on repetition.
Syntax
-moz-background-inline-policy: bounding-box | continuous | each-box
Values
- bounding-box
- The background image is positioned (and repeated) in the smallest rectangle that contains all of the inline boxes for the element. It is then clipped to be visible only within those boxes, according to the
-moz-background-clip
property. - continuous
- The background image is positioned (and repeated) as if the inline box were not broken across lines, and then this long rectangle is sliced into pieces for each line.
- each-box
- The background image is positioned (and repeated) separately for each box of the inline element. This means that an image with
background-repeat
: no-repeat
may be repeated multiple times.
Notes
-moz-background-inline-policy
is supported since Gecko 1.3 (Firefox 1.0).
« CSS « CSS Reference
Summary
The background-origin
CSS property determines the background positioning area (the origin of a background-image).
background-origin
does not apply when
background-attachment
is fixed
.
This property is reset to its initial value by the
background
shorthand property.
Syntax
/* since Gecko 2.0 (Firefox 4.0) */
background-origin: [padding-box | border-box | conten
t-box
][, [border-box | padding-box | conten
t-box
]]*
/* older versions (multiple backgrounds since Gecko 1.9.2 / Firefox 3.6) */
-moz-background-origin: [padding | border | conten
t
][, [border | padding | conten
t
]]*
Values
- padding-box
New in Firefox 4
padding (Firefox 1.0-3.6)
- Default value. The background position is relative to the padding. (For single boxes "
0 0
" is the upper left corner of the padding edge, "100% 100%
" is the lower right corner.) - border-box
New in Firefox 4
border (Firefox 1.0-3.6)
- The background position is relative to the border, so the image can go behind the border.
- content-box
New in Firefox 4
content (Firefox 1.0-3.6)
- The background position is relative to the content.
Examples
.example {
border: 10px double;
padding: 10px;
background: url('image.jpg');
background-position: center left;
/* The background will be inside the padding */
-moz-background-origin: content; /* Firefox 1.0-3.6 */
-webkit-background-origin: content-box; /* Safari, Chrome */
background-origin: content-box; /* Firefox 4.0+ */
}
div {
background-image: url('mainback.png'), url('logo.jpg');
background-position: 0px 0px, top right;
-moz-background-origin: padding, content;
-webkit-background-origin: padding-box, content;
background-origin: padding-box, content-box;
}
Browser compatibility
Browser | Lowest version | Support of |
Chrome | 1.0 |
-webkit-background-origin: padding | border | content
-webkit-background-origin: padding-box | border-box | content-box
|
1.0 |
background-origin: padding | border | content
background-origin: padding-box | border-box | content-box
|
Firefox (Gecko) | 1.0-3.6 (1.2-1.9.2) | -moz-background-origin: padding | border | content |
4.0 (2.0) | background-origin: padding-box | border-box | content-box |
Internet Explorer | 9.0 [*] | background-origin: padding-box | border-box | content-box |
Opera | 10.5 | background-origin: padding-box | border-box | content-box |
Safari (WebKit) | 3.0 (522) | -webkit-background-origin: padding | border | content |
4.0 | -webkit-background-origin: padding-box | border-box | content-box |
5.0 | background-origin: padding-box | border-box | content-box |
- [*] IE up to version 7 behaves as if it were
background-origin: border-box;
- [**] IE 8 behaves as if it were
background-origin: padding-box;
- Konqueror 3.5.4 supports
-khtml-background-origin
.
Summary
The background-size
CSS property specifies the size of the background images.
Syntax
background-size: <bg-size>[, <bg-size>]* /* Gecko 2.0 (Firefox 4.0) and later */
Where <bg-size> is one of:
Multiple values apply to individual background layers, from front to back, in the same manner as for all other background properties.
Values
- <percentage>
- Scales the background image in the desired dimension to the specified percentage of the background positioning area, which is determined by the value of
background-origin
. The background positioning area is, by default, the area containing the content of the box and its padding; the area may also be changed to just the content or to the area containing borders, padding, and content. If the background's
attachment
is fixed
, the background positioning area is instead the entire area of the browser window, not including the area covered by scrollbars if they are present. - <length>
- Scales the background image to the specified length in the desired dimension.
- auto
- Scales the background image in the relevant direction such that its intrinsic proportion is maintained.
The first value determines how the image is scaled horizontally, the second how it is scaled vertically. If only one value is specified, the second value is implicitly auto
. Negative sizes are not allowed.
- contain
- Specifies that the background image should be scaled to be as large as possible while ensuring both its dimensions are less than or equal to the corresponding dimensions of the background positioning area.
- cover
- Specifies that the background image should be scaled to be as small as possible while ensuring both its dimensions are greater than or equal to the corresponding dimensions of the background positioning area.
Interpretation of possible values depends on the image's intrinsic dimensions (width and height) and intrinsic proportion (ratio of width and height). A bitmap image always has intrinsic dimensions and an intrinsic proportion. A vector image may have both intrinsic dimensions (and thus must have an intrinsic proportion). It also may have one or no intrinsic dimension, and in either case it might or might not have an intrinsic proportion. Gradients are treated as images with no intrinsic dimensions or intrinsic proportion.
Gecko 8.0 note
(Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5)
This behavior changed in Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5)
. Before this, gradients were treated as images with no intrinsic dimensions, with an intrinsic proportion identical to that of the background positioning area.
Background images generated from elements using
-moz-element
(which actually match an element) are currently treated as images with the dimensions of the element, or of the background positioning area if the element is SVG, with the corresponding intrinsic proportion.
Note: This is not the currently-specified behavior, which is that the intrinsic dimensions and proportion should be those of the element in all cases.
The rendered size of the background image is then computed as follows:
- If both components of
background-size
are specified and are not auto
: - The background image renders at the specified size.
- If the
background-size
is contain
or cover
: - The image is rendered, preserving its intrinsic proportion, at the largest size contained within, or covering, the background positioning area. If the image has no intrinsic proportion, then it is rendered at the size of the background positioning area.
- If the
background-size
is auto
or auto auto
: - If the image has both intrinsic dimensions, it is rendered at that size. If it has no intrinsic dimensions and no intrinsic proportion, it is rendered at the size of the background positioning area. If it has no dimensions but has a proportion, it's rendered as if
contain
had been specified instead. If the image has one intrinsic dimension and a proportion, it's rendered at the size determined by that one dimension and the proportion. If the image has one intrinsic dimension but no proportion, it's rendered using the intrinsic dimension and the corresponding dimension of the background positioning area. - If the background-size has one
auto
component and one non-auto
component: - If the image has an intrinsic proportion, then render it using the specified dimension, and compute the other dimension from the specified dimension and the intrinsic proportion. If the image has no intrinsic proportion, use the specified dimension for that dimension. For the other dimension, use the image's corresponding intrinsic dimension if there is one. If there is no such intrinsic dimension, use the corresponding dimension of the background positioning area.
Note that background sizing for vector images that lack intrinsic dimensions or proportion is not yet fully implemented in all browsers. Be careful about relying on the behavior described above, and test in multiple browsers (specifically including versions of Firefox 7 or earlier and Firefox 8 or greater) to be sure different renderings are acceptable.
Notes
While this property is new in Gecko 1.9.2 (Firefox 3.6), it is possible to stretch a image fully over the background in Firefox 3.5 by using
-moz-border-image
.
.foo {
background-image: url(bg-image.png);
-moz-background-size: 100% 100%; /* Gecko 1.9.2 (Firefox 3.6) */
-o-background-size: 100% 100%; /* Opera 9.5 */
-webkit-background-size: 100% 100%; /* Safari 3.0 */
background-size: 100% 100%; /* Gecko 2.0 (Firefox 4.0) and other CSS3-compliant browsers */
-moz-border-image: url(bg-image.png) 0; /* Gecko 1.9.1 (Firefox 3.5) */
}
If you are specifying a gradient as background and have specified a background-size
to go with it, it's best not to specify a size that uses a single auto component, or is specified using only a width value (for example, background-size: 50%
). Rendering of gradients in such cases changed in Firefox 8, and at present it is generally inconsistent across browsers, which do not all implement rendering in full accordance with the CSS3 background-size
specification and with the CSS3 Image Values gradient specification.
.bar {
width: 50px; height: 100px;
background-image: gradient(...);
/* NOT RECOMMENDED */
background-size: 25px;
background-size: 50%;
background-size: auto 50px;
background-size: auto 50%;
/* OKAY */
background-size: 25px 50px;
background-size: 50% 50%;
}
Note that it's particularly not recommended to use a pixel dimension and an auto
dimension with a gradient, because it's impossible to replicate rendering in versions of Firefox prior to 8, and in browsers not implementing Firefox 8's rendering, without knowing the exact size of the element whose background is being specified.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0
-webkit
| 3.6 (1.9.2)
-moz
| 9.0 | 9.5
-o with some bugs (see below) | 3.0 (522)
-webkit but from an older CSS3 draft (see below) |
3.0 | 4.0 (2.0)
| 10.0 |
Support for
contain | cover
| 3.0 | 3.6 (1.9.2)
| 9.0 | 10.0 | 4.1 (532) |
Support for SVG backgrounds | ? | 8.0 (8.0)
| ? | ? | ? |
Feature | Android | Firefox Mobile (Gecko) | Windows Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
Support for SVG backgrounds | ? | 8.0 (8.0)
| ? | ? | ? |
- As of July 2009, Opera 9.5's computation of the background positioning area is incorrect for fixed backgrounds. Opera 9.5 also interprets the two-value form as a horizontal scaling factor and, from appearances, a vertical clipping dimension.
- WebKit-based browsers as of July 2009 implement an older draft of CSS3
background-size
in which an omitted second value is treated as duplicating the first value; this draft does not include the contain
or cover
keywords. - Konqueror 3.5.4 supports
-khtml-background-size
. -
-moz-background-size
is no longer supported in Gecko 2.0; you must use background-size
instead. - See Scaling of SVG backgrounds for details on how SVG images are scaled when used for
background-size
.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
The -moz-binding
CSS property is used by Mozilla-based applications to attach an XBL binding to a DOM element.
Syntax
-moz-binding:
<uri>
| none
Values
- <uri>
- The URI for the XBL binding (including the fragment identifier).
none
- No XBL binding is applied to the element.
Examples
.exampleone {
-moz-binding: url("http://www.example.org/xbl/htmlBindings.xml#checkbox");
}
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
In Mozilla applications like Firefox, -moz-border-bottom-colors
sets a list of colors for the bottom border.
See the
-moz-border-top-colors
property for more information.
Summary
The border-image
CSS property allows drawing an image on the borders of elements. This makes drawing complex looking widgets much simpler than it has been and removes the need for nine boxes in some cases.
Warning: The official CSS 3 specification for the border-image property changed significantly between the time this feature was frozen for Gecko 1.9.1 and its release. As such, both the syntax and semantics of this feature will probably change in future releases of Gecko. In particular, the optional border-width
override has been removed from the specification and will almost certainly be removed in a future version of Gecko.
The border-image
is used instead of the border styles given by the
border-style
properties. If the value is none
or if the image cannot be displayed, the border styles will be used. An additional background image for the element is drawn on top of the
background-image
.
Syntax
none |
[ <image> [ <number> | <percentage> ]{1,4} [/ <border-width>{1,4}]? ] && [ stretch | repeat | round ]{0,2}
Values
- none
- No image displayed, other border styles are used.
- <image> (required)
- The image value is a
<uri>
, e.g. url(http://example.org/image.png)
- <number> | <percentage> (required)
- One, two, three or four values represent inward offsets from the top, right, bottom, and left edges of the image (respectively), dividing it into nine regions: four corners, four edges and a middle.

One value belongs to all four sides of the image.
Two values belong 1. to top and bottom and 2. to right and left side.
Three values belong 1. to top, 2. to the right and left side and 3. to bottom.
Four values belong to the top, right, bottom and left edge of the image in that order.
In Gecko 1.9.1 (Firefox 3.5) the middle part of the image is drawn like a background-image of the element. This may change in future versions.
Percentages are relative to the width/height of the image.
Numbers represent pixels in the image (if the image is a raster image) or vector coordinates (if the image is an SVG image). - <border-width> (optional)
- If the slash / is present in the property value, the one, two, three or four values after it are used for the width of the border instead of the
border-width
properties. The order of the values is the same as for
border-width
. - stretch | round | repeat (optional)
- One or two keywords, that specify how the images for the sides and the middle part are scaled and tiled.
stretch
(default value) will cause images to be scaled to fit their box.
round
will tile the images, but also scale them so that a whole number fit in the box.
repeat
simply tiles the images inside the box.
The first keyword describes how to draw the top, middle, and bottom images, while the second describes the left and right borders. If the second is absent, it is assumed to be the same as the first. If both are absent, the default value stretch
is used.
Examples
[needs some instructive live examples]
#header { -moz-border-image: url(border.png) 27 27 27 27 round round; }
.button { -moz-border-image: url(button.png) 0 5 0 5; }
.example { -moz-border-image: url(example.jpg) 3 4 6 8 / 10px 12px 14px 22px; }
/* Edge case, acts like a full scaled background-image in Firefox 3.5 */
div { -moz-border-image: url(bgimage.png) 0; }
Browser compatibility
Note: Features beyond basic support are not yet documented in above sections. Please read the spec if you are interested.
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 3.5 (1.9.1)
-moz
| 7.0
-webkit
| -- | 10.5 / 11.0
-o
| 3.0
-webkit
|
optional <border-image-slice>
|
-- Unimplemented (see
bug 497995
)
| ? | -- | ? | ? |
fill keyword | -- | ? | -- | ? | ? |
Feature | iOS Safari | Opera Mini | Opera Mobile | Android Browser |
Basic support | 3.2
-webkit
| -- | 11.0
-o
| 2.1
-webkit
|
optional <border-image-slice>
| ? | -- | ? | ? |
fill keyword | ? | -- | ? | ? |
Notes
- Unusually, for Opera, the prefixed property was added after the non-prefixed.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
In Mozilla applications like Firefox, the -moz-border-left-colors
sets a list of colors for the left border.
See the
-moz-border-top-colors
property for more information.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
In Mozilla applications like Firefox, -moz-border-right-colors
sets a list of colors for the right border.
See the
-moz-border-top-colors
property for more information.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
In Mozilla applications like Firefox, the
-moz-border-top-colors
CSS property sets a list of colors for the top border.
When an element has a border that is larger than a single CSS pixel, each line of pixels uses the next color specified in this property, from the outside in. This eliminates the need for nested boxes. If the border is wider than the number of specified colors, the remaining part of the border is the innermost color specified.
- Initial value:
none
- Applies to: all elements
- Inherited: no
It does not apply
- if
border-style
is dashed
or dotted
. - to tables with
border-collapse: collapse.
Syntax
-moz-border-top-colors: [<color>]* <color> | none
Values
Accepts a white-space separated list of color values.
- <color>
- Specifies the color of a line of pixels in the bottom border.
transparent
is valid. See
<color>
values for possible units.
- none
- Default, no colors are drawn or
border-color
is used, if specified.
Examples
/* Other browsers use a "inset gold 10px" border */
border: inset gold 10px; color:gold; background:gray; padding:1em;
-moz-border-top-colors: #e00 #c30 #c50 #c60 #c70 #c80 #c90 #ca0 #cb0 #cc0;
-moz-border-right-colors: red #f60 #f80 #f90 #fa0 #fb0 #fc0 #fd0 #fe0 #ff0;
-moz-border-bottom-colors: red #f60 #f80 #f90 #fa0 #fb0 #fc0 #fd0 #fe0 #ff0;
-moz-border-left-colors: #e00 #c30 #c50 #c60 #c70 #c80 #c90 #ca0 #cb0 #cc0;
/* Other browsers use a "solid 1.5em" border */
border: solid 1.5em; -moz-border-radius:1.5em; border-radius:1.5em;
-moz-border-top-colors: maroon maroon khaki maroon khaki maroon maroon transparent;
-moz-border-right-colors: maroon maroon khaki maroon khaki maroon maroon magenta;
-moz-border-bottom-colors: maroon maroon khaki maroon khaki maroon maroon transparent;
-moz-border-left-colors: maroon maroon khaki maroon khaki maroon maroon transparent;
Specifications
Non-standard
Browser compatibility
Supported since Gecko 1.0 (Firefox 1.0), no support in other major browsers.
« CSS « CSS Reference
Summary
The CSS box-align
property specifies how an element aligns its contents across (perpendicular to) the direction of its layout. The effect of this is only visible if there is extra space in the box.
The direction of layout depends on the element's orientation: horizontal or vertical.
Syntax
box-align: start | center | end | baseline | stretch /* As specified */
-moz-box-align: start | center | end | baseline | stretch /* Mozilla */
-webkit-box-align: start | center | end | baseline | stretch /* WebKit */
Values
start
- The box aligns contents at the start, leaving any extra space at the end.
center
- The box aligns contents in the center, dividing any extra space equally between the start and the end.
end
- The box aligns contents at the end, leaving any extra space at the start.
baseline
- The box aligns the baselines of the contents (lining up the text). This only applies if the box's orientation is horizontal.
stretch
- The box stretches the contents so that there is no extra space in the box.
Examples
<!DOCTYPE html>
<html>
<head>
<title>CSS box-align example</title>
<style>
div.example {
display: box; /* As specified */
display: -moz-box; /* Mozilla */
display: -webkit-box; /* WebKit */
/* Make this box taller than the children,
so there is room for the box-pack */
height: 400px;
/* Make this box wider than the children
so there is room for the box-align */
width: 300px;
/* Children should be oriented vertically */
box-orient: vertical; /* As specified */
-moz-box-orient: vertical; /* Mozilla */
-webkit-box-orient: vertical; /* WebKit */
/* Align children to the horizontal center of this box */
box-align: center; /* As specified */
-moz-box-align: center; /* Mozilla */
-webkit-box-align: center; /* WebKit */
/* Pack children to the bottom of this box */
box-pack: end; /* As specified */
-moz-box-pack: end; /* Mozilla */
-webkit-box-pack: end; /* WebKit */
}
div.example > p {
/* Make children narrower than their parent,
so there is room for the box-align */
width: 200px;
}
</style>
</head>
<body>
<div class="example">
<p>I will be second from the bottom of div.example, centered horizontally.</p>
<p>I will be on the bottom of div.example, centered horizontally.</p>
</div>
</body>
</html>
Notes
The edge of the box designated the start for alignment purposes depends on the box's orientation:
Horizontal | top |
Vertical | left |
The edge opposite to the start is designated the end.
If the alignment is set using the element's align
attribute, then the style is ignored.
« CSS « CSS Reference
Summary
The CSS box-direction
property specifies whether a box lays out its contents normally (from the top or left edge), or in reverse (from the bottom or right edge).
Syntax
box-direction: normal | reverse | inherit /* As specified */
-moz-box-direction: normal | reverse | inherit /* Mozilla */
-webkit-box-direction: normal | reverse | inherit /* WebKit */
Values
normal
- The box lays out its contents from the start (the left or top edge).
reverse
- The box lays out its contents from the end (the right or bottom edge).
Examples
.example {
/* bottom-to-top layout */
box-direction: reverse; /* As specified */
-moz-box-direction: reverse; /* Mozilla */
-webkit-box-direction: reverse; /* WebKit */
}
Notes
The edge of the box designated the start for layout purposes depends on the box's orientation:
Horizontal | left |
Vertical | top |
The edge opposite to the start is designated the end.
If the direction is set using the element's dir
attribute, then the style is ignored.
« CSS « CSS Reference
Summary
The CSS box-flex
property specifies how a box grows to fill the box that contains it, in the direction of the containing box's layout.
Syntax
box-flex: number /* As specified */
-moz-box-flex: number /* Mozilla */
-webkit-box-flex: number /* WebKit */
Values
- 0
- The box does not grow.
- > 0
- The box grows to fill a proportion of the available space.
Examples
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<style>
div.example {
display: box;
display: -moz-box;
display: -webkit-box;
}
div.example > p:nth-child(1) {
box-flex: 1; /* As specified */
-moz-box-flex: 1; /* Mozilla */
-webkit-box-flex: 1; /* WebKit */
}
div.example > p:nth-child(2) {
box-flex: 0; /* As specified */
-moz-box-flex: 0; /* Mozilla */
-webkit-box-flex: 0; /* WebKit */
}
</style>
<div class="example">
<p>I will expand to fill extra space</p>
<p>I will not expand</p>
</div>
</body>
</html>
Notes
The containing box allocates the available extra space in proportion to the flex value of each of the content elements.
Content elements that have zero flex do not grow.
If only one content element has nonzero flex, then it grows to fill the available space.
Content elements that have the same flex grow by the same absolute amounts.
If the flex value is set using the element's flex
attribute, then the style is ignored.
To make XUL elements in a containing box the same size, set the containing box's equalsize
attribute to the value always
. This attribute does not have a corresponding CSS property.
A trick to make all content elements in a containing box the same size, is to give them all a fixed size (e.g. height: 0
), and the same box-flex value greater than zero (e.g. box-flex: 1
).
Summary
Indicates the ordinal group the element belongs to. Elements with a lower ordinal group are displayed before those with a higher ordinal group.
Values
Values must be integers greater than zero. The default value for this property is 1.
Examples
<style type="text/css">
#Flexbox {
display: -ms-box;
display: -moz-box;
display: -webkit-box;
}
#text1 {
background: red;
-ms-box-ordinal-group: 4;
-moz-box-ordinal-group: 4;
-webkit-box-ordinal-group: 4;
}
#text2 {
background: green;
-ms-box-ordinal-group: 3;
-moz-box-ordinal-group: 3;
-webkit-box-ordinal-group: 3;
}
#text3 {
background: blue;
-ms-box-ordinal-group: 2;
-moz-box-ordinal-group: 2;
-webkit-box-ordinal-group: 2;
}
#text4 {
background: orange;
}
</style>
<div id="Flexbox">
<div id="text1">text 1</div>
<div id="text2">text 2</div>
<div id="text3">text 3</div>
<div id="text4">text 4</div>
</div>
« CSS « CSS Reference
Summary
The CSS box-orient
property specifies whether an element lays out its contents horizontally or vertically.
For example, XUL
box
and
hbox
elements lay out their contents horizontally by default, but XUL
vbox
elements lay out their contents vertically by default.
HTML DOM elements lay out their contents along the inline-axis by default. This CSS property will only apply to HTML elements with a CSS
display
value of
box
or
inline-box
.
Syntax
box-orient: horizontal | vertical | inline-axis | block-axis | inherit /* As specified */
-moz-box-orient: horizontal | vertical | inline-axis | block-axis | inherit /* Mozilla */
-webkit-box-orient: horizontal | vertical | inline-axis | block-axis | inherit /* WebKit */
Values
horizontal
- The box lays out its contents horizontally.
vertical
- The box lays out its contents vertically.
-
inline-axis
(HTML) - The box displays its children along the inline axis.
-
block-axis
(HTML) - The box displays its children along the block axis.
The inline and block axes are the writing-mode dependent keywords which, in English, map to horizontal and vertical respectively.
Examples
<!DOCTYPE html>
<html>
<head>
<title>CSS box-orient example</title>
<style>
div.example {
display: box; /* As specified */
display: -moz-box; /* Mozilla */
display: -webkit-box; /* WebKit */
/* Children should be oriented vertically */
box-orient: horizontal; /* As specified */
-moz-box-orient: horizontal; /* Mozilla */
-webkit-box-orient: horizontal; /* WebKit */
}
</style>
</head>
<body>
<div class="example">
<p>I will be to the left of my sibling.</p>
<p>I will be to the right of my sibling.</p>
</div>
</body>
</html>
Notes
For XUL elements, if the orientation is set using the element's
orient
attribute, then the style is ignored.
« CSS « CSS Reference
Summary
The CSS box-pack
property specifies how a box packs its contents in the direction of its layout. The effect of this is only visible if there is extra space in the box.
The direction of layout depends on the element's orientation: horizontal or vertical.
Syntax
box-pack: start | center | end | justify /* As specified */
-moz-box-pack: start | center | end | justify /* Mozilla */
-webkit-box-pack: start | center | end | justify /* WebKit */
Values
start
- The box packs contents at the start, leaving any extra space at the end.
center
- The box packs contents in the center, dividing any extra space equally between the start and the end.
end
- The box packs contents at the end, leaving any extra space at the start.
justify
- The space is divided evenly in-between each child, with none of the extra space placed before the first child or after the last child. If there is only one child, treat the pack value as if it were start.
Examples
<!DOCTYPE html>
<html>
<head>
<title>CSS box-pack example</title>
<style>
div.example {
display: box; /* As specified */
display: -moz-box; /* Mozilla */
display: -webkit-box; /* WebKit */
/* Make this box taller than the children,
so there is room for the box-pack */
height: 400px;
/* Children should be oriented vertically */
box-orient: vertical; /* As specified */
-moz-box-orient: vertical; /* Mozilla */
-webkit-box-orient: vertical; /* WebKit */
/* Align children to the horizontal center of this box */
box-align: center; /* As specified */
-moz-box-align: center; /* Mozilla */
-webkit-box-align: center; /* WebKit */
/* Pack children to the bottom of this box */
box-pack: end; /* As specified */
-moz-box-pack: end; /* Mozilla */
-webkit-box-pack: end; /* WebKit */
}
div.example > p {
/* Make children narrower than their parent,
so there is room for the box-align */
width: 200px;
}
</style>
</head>
<body>
<div class="example">
<p>I will be second from the bottom of div.example, centered horizontally.</p>
<p>I will be on the bottom of div.example, centered horizontally.</p>
</div>
</body>
</html>
Notes
The edge of the box designated the start for packing purposes depends on the box's orientation and direction:
| Normal | Reverse |
Horizontal | left | right |
Vertical | top | bottom |
The edge opposite to the start is designated the end.
If the packing is set using the element's pack
attribute, then the style is ignored.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
The -moz-calc()
CSS function can be used anywhere a
<length>
is required. With -moz-calc()
, you can perform calculations to determine the size and shape of objects.
Syntax
<a_css_property>: -moz-calc(expression)
Values
- expression
- A mathematical expression, the result of which is used as the
<length>
.
Expressions
The expression can be any simple expression combining the following operators:
- +
- Addition
- -
- Subtraction
- *
- Multiplication
- /
- Division. You can't divide by a length; instead, this is used to, for example, say that you want your resulting length to be a given fraction of an existing length.
- mod
Unimplemented
- Modulo; this returns the remainder left over after dividing two values.
The operands in the expression may be any length syntax value. You can use different units for each value in your expression, if you wish. You may also use parentheses to establish computation order when needed.
Note: Division by zero results in an error being generated by the HTML parser.
Examples
Positioning an object on screen with a margin
-moz-calc()
makes it easy to position an object with a set margin. In this example, the CSS creates a banner that stretches across the window, with a 40-pixel gap between both sides of the banner and the edges of the window:
.banner {
position:absolute;
left: 40px;
width: -moz-calc(100% - 80px);
border: solid black 1px;
box-shadow: 1px 2px;
background-color: yellow;
padding: 6px;
text-align:center;
}
View the live example
Automatically sizing form fields to fit their container
Another use case for -moz-calc()
is to help ensure that form fields fit in the available space, without extruding past the edge of their container, while maintaining an appropriate margin.
Let's look at some CSS:
input {
padding: 2px;
display: block;
width: -moz-calc(100% - 1em);
}
#formbox {
width: -moz-calc(100%/6);
border: 1px solid black;
padding: 4px;
}
Here, the form itself is established to use 1/6 of the available window width. Then, to ensure that input fields retain an appropriate size, we use -moz-calc()
again to establish that they should be the width of their container minus 1em. Then, the following HTML makes use of this CSS:
<form>
<div id="formbox">
<label>Type something:</label>
<input type="text">
</div>
</form>
View the live example
Browser compatibility
Browser | Lowest version |
Internet Explorer | 9.0 |
Firefox (Gecko) | 4.0 (2.0) |
Opera | - |
Safari (WebKit) | - |
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Don't use this value! Use the cursor
value
cell
instead.
Summary
The column-count
CSS property describes the number of columns of the element.
Syntax
column-count: integer or
column-count: auto
where :
- auto
- Is a keyword indicating that the number of columns should be determined by other CSS properties, like
column-width
. - integer
- Is a strictly positive
<integer>
describing the ideal number of columns into which the content of the element will be flowed. If the
column-width
is also set to a non-auto value, it merely indicates the maximum allowed number of columns.
Examples
.content-box {
border: 10px solid #000000;
column-count:3;
}
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 1.5 (1.8)
-moz
| 10 | 11.1 | 3.0 (522)
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | (Supported) | ? | ? | ? |
Summary
The column-gap
CSS property sets the size of the gap between columns for elements which are specified to display as a multi-column element.
Syntax
column-gap: length or
column-gap: normal
where :
normal
- Is a keyword indicating to use the browser-defined default spacing between columns. The specification, and most modern browsers follow it, recommends this keyword to be equal to a length of
1em
. - length
- Is a
<length>
value defining the size of the gap between columns. It must not be negative, but may be equal to 0
.
Examples
.content-box {
border: 10px solid #000000;
column-count: 3;
column-gap: 20px;
}
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 1.5 (1.8)
-moz [*] | 10 | 11.1 | 3.0 (522)
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | (Supported) | ? | ? | ? |
[*] Before Firefox 3 (Gecko 1.9), the default value associated to the normal
keyword was 0
and not 1em
.
Summary
The column-rule-color
CSS property lets you set the color of the rule drawn between columns in multi-column layouts.
Syntax
column-rule-color: <color>
Example
#header {column-rule-color: blue;
}
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 3.5 (1.9.1)
-moz
| 10 | 11.1 | 3.0 (522)
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | (Supported) | ? | ? | ? |
Summary
In multi-column layouts, the column-rule
CSS property specifies a straight line, or "rule", to be drawn between each column. It is a convenient shorthand to avoid setting each of the individual column-rule-*
properties separately :
column-rule-width
,
column-rule-style
and
column-rule-color
.
Syntax
column-rule: <border-width> || <border-style> || <color>
Values
Accepts one, two or three values in any order:
- <border-width>
-
Optional, is one value or keyword of:
<length>
| thin | medium | thick
Default value medium
is used if absent. See
border-width
for details. - <border-style>
-
Required, default value
none
is used if absent. See
border-style
for possible values and details. - <color>
-
Optional, see
<color>
value. Default value if absent:
currentColor
, the value of the element's color
property (foreground color).
Examples
p.foo { column-rule: dotted; } /* same as "medium dotted currentColor" */
p.bar { column-rule: solid blue; } /* same as "medium solid blue" */
p.baz { column-rule: solid 8px; } /* same as "8px solid currentColor" */
p.abc { column-rule: thick inset blue;
}
Live Example
padding:0.3em; background:gold; border:groove 2px gold; column-rule: inset 2px gold; column-width:17em;
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 3.5 (1.9.1)
-moz
| 10 | 11.1 | 3.0 (522)
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | (Supported) | ? | ? | ? |
Summary
The column-rule-style
CSS property lets you set the style of the rule drawn between columns in multi-column layouts.
Syntax
column-rule-style: <border-style>
Example
#header {-moz-column-rule-style: inset;
}
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 3.5 (1.9.1)
-moz
| 10 | 11.1 | 3.0 (522)
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | (Supported) | ? | ? | ? |
Summary
The column-rule-width
CSS property lets you set the width of the rule drawn between columns in multi-column layouts.
Syntax
column-rule-width: <border-width>
Example
#header {column-rule-width: thick;
}
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 3.5 (1.9.1)
-moz
| 10 | 11.1 | 3.0 (522)
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | (Supported) | ? | ? | ? |
Summary
The column-width
CSS property suggests an optimal column width. This is not a absolute value but a mere hint. Browser will adjust the width of the column around that suggested value, allowing to achieve scalable designs that fit different screen size. Especially in presence of the
column-count
CSS property which has precedence, to set an exact column width, all length values must be specified. In horizontal text these are
width
,
column-width
,
column-gap
, and
column-rule-width
.
Syntax
column-width: length or
column-width: auto
where :
- length
- Is a
<length>
value giving a hint of the optimal width of the column. The actual column width may be wider (to fill the available space), or narrower (only if the available space is smaller than the specified column width). The length must be strictly positive or the declaration is invalid. -
auto
- Is a keyword indicating that the width of the column should be determined by other CSS properties, like
column-count
.
Examples
.content-box {
border: 10px solid #000000;
column-width: 300px;
}
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 1.5 (1.8)
-moz
| 10 | 11.1 | 3.0 (522)
-webkit
|
Intrinsic sizes | -- | -- | -- | -- | -- |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | (Supported) | ? | ? | ? |
Intrinsic sizes | -- | -- | -- | -- | -- |
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Don't use this value! Use the cursor value
context-menu
instead.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Don't use this value! Use the cursor
value
copy
instead.
« CSS « CSS Reference
The element()
CSS function defines an <image>
value generated from an arbitrary HTML element. This image is live, meaning that if the HTML element is changed, the CSS properties using the resulting value are automatically updated.
A particularly useful scenario for using this would be to render an image in an HTML
<canvas>
element, then use that as a background.
On Gecko browsers, you can use the non-standard
document.mozSetImageElement()
method to change the element being used as the background for a given CSS background element.
This is an experimental feature
Because this feature is still in development in some browsers, check the compatibility table for the proper prefixes to use in various browsers.
Syntax
element( id )
where:
id
- The ID of an element to use as the background, specified using the HTML attribute #id on the element.
Examples
These examples can be viewed live in builds of Firefox that support -moz-element()
.
A somewhat realistic example
This example uses a hidden
<div>
as a background. The background element uses a gradient, but also includes text that is rendered as part of the background.
<div style="width:400px; height:400px; background:-moz-element(#myBackground1) no-repeat;">
<p>This box uses the element with the #myBackground1 ID as its background!</p>
</div>
<div style="overflow:hidden; height:0;">
<div id="myBackground1" style="width:1024px; height:1024px; background-image: -moz-linear-gradient(left, red, orange, yellow, white);">
<p style="-moz-transform-origin:0 0; -moz-transform: rotate(45deg); color:white;">This text is part of the background. Cool, huh?</p>
</div>
</div>
The
<div>
element with the ID "myBackground1" is used as the background for the content including the paragraph "This box uses the element with the #myBackground1 ID as its background!".

A somewhat more bizarre example
This example uses a hidden
<button>
element in a repeating pattern as its background. This demonstrates that you can use arbitrary elements as background, but doesn't necessarily demonstrate good design practices.
<div style="width:400px; height:100px; background:-moz-element(#myBackground2);">
</div>
<div style="overflow:hidden; height:0;">
<button id="myBackground2" type="button">Evil button!</button>
</div>

Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 4.0 (2.0) [1] [*]
-moz
| -- | -- | -- |
-- [2]
|
Feature | Firefox Mobile (Gecko) | Android | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 4.0 (2.0) [3] [*]
-moz
| -- | -- | -- | -- |
[*] Usage limited to the
background
and
background-image
CSS properties.
Syntax
filter: url(svg-url#element-id)
Examples
.target { filter: url(#c1); }
.anothertarget { filter: url(resources.svg#c1); }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | ? | 3.5 (1.9.1) |
--[*] | ? | ? |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
[*] From Internet Explorer 5.5 to Internet Explorer 7.0 included, that browser implemented a non-standard filter
property. The syntax was completely different from this one and is not documented here.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 2.0
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Summary
The -moz-font-feature-settings
CSS property allows control over advanced typographic features in OpenType fonts.
Syntax
-moz-font-feature-settings : normal | <string>
where <string> is defined as quoted list of OpenType feature tag-value pairs
Values
- normal
- Text is laid out using default settings.
- <string>
- When rendering text, the list of OpenType feature tags is passed to the text layout engine to enable or disable font features. For example, "tagx=1" implies that the OpenType feature 'tagx' is enabled. Using a value of 0 disables a given feature. For non-boolean OpenType features (e.g. stylistic alternates), the value implies a particular glyph to be selected.
Examples
/* use small-cap alternate glyphs */
.smallcaps { -moz-font-feature-settings: "smcp=1"; }
/* convert both upper and lowercase to small caps (affects punctuation also) */
.allsmallcaps { -moz-font-feature-settings: "c2sc=1, smcp=1"; }
/* enable historical forms */
.hist { -moz-font-feature-settings: "hist=1"; }
/* disable common ligatures, usually on by default */
.noligs { -moz-font-feature-settings: "liga=0"; }
/* enable tabular (monospaced) figures */
td.tabular { -moz-font-feature-settings: "tnum=1"; }
/* enable automatic fractions */
.fractions { -moz-font-feature-settings: "frac=1"; }
/* use the second available swash character */
.swash { -moz-font-feature-settings: "swsh=2"; }
/* enable stylistic set 7 */
.fancystyle {
font-family: Gabriola; /* available on Windows 7 */
-moz-font-feature-settings: "ss07=1";
}
Notes
This syntax for this property is still under development and will likely change as the CSS3 Fonts specification evolves. Authors should not rely on the current syntax being supported in future versions of Firefox.
Browser compatibility
Supported in Gecko 2.0 (Firefox 4.0), no support in other major browsers.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
-moz-force-broken-image-icon
is an extended CSS property. The value 1
forces a broken image icon even if the image has an alt
attribute. When the value 0
is used the image will act as usual and only display the alt
attribute.
Note: Even if the value is set to 1
the alt
attribute will still be displayed. More information is available below.
Syntax
-moz-force-broken-image-icon: <integer>;
Examples
View Live Examples (not available, please check later)
img {
-moz-force-broken-image-icon: 1;
height:100px;
width:100px;
}
Note: Unless the image has a specified height and width the broken image icon will not be displayed but the alt attribute will also be hidden if -moz-force-broken-image-icon
is set to 1
.
Notes
- This property will only work in Gecko-based browsers.
- The use of this property is not recommended. A proper alt attribute should be used instead.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
In Mozilla products like Firefox, the -moz-grabbing
CSS cursor indicates that an element or an object is actually being grabbed, is actually being moved and repositioned in drag-and-drop DHTML snippet.
The -moz-grabbing
cursor looks like a hand with its 5 fingers contracted, like a fist.
On Windows, it looks like this: 
The natural complementary cursor value for -moz-grabbing
is -moz-grab
. Together, these 2 cursor values are graphically very intuitive.
- This cursor value is a Mozilla CSS Extension.
- There is no CSS standard for this cursor.
- Support since Gecko 1.8/ Firefox 1.5.
- This cursor is not recommended for use on public web pages. Custom image cursors may provide better cross browser compatibility.
See also:
cursor
,
-moz-grab
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
In Mozilla products like Firefox, the -moz-grab
CSS cursor indicates that an element or an object can be grabbed to be moved, to be repositioned in drag-and-drop DHTML snippet.
The -moz-grab
cursor looks like a hand with its 5 fingers extended.
On Windows, it looks like this: 
The natural complementary cursor value for -moz-grab
is -moz-grabbing
. Together, these 2 cursor values are graphically very intuitive.
- This cursor value is a Mozilla CSS Extension.
- There is no CSS standard for this cursor.
- Support since Gecko 1.8/ Firefox 1.5.
- This cursor is not recommended for use on public web pages. Custom image cursors may provide better cross browser compatibility.
See also:
cursor
,
-moz-grabbing
« CSS « CSS Reference
Summary
The overflow
CSS property specifies whether to clip content, render scroll bars or display overflow content of a block-level element.
Syntax
overflow: visible | hidden | scroll | auto |
inherit
Values
- visible
- Default value. Content is not clipped, it may be rendered outside the content box.
- hidden
- The content is clipped and no scrollbars are provided.
- scroll
- The content is clipped and desktop browsers use scrollbars, whether or not any content is clipped. This avoids any problem with scrollbars appearing and disappearing in a dynamic environment. Printers may print overflowing content.
- auto
- Depends on the user agent. Desktop browsers like Firefox provide scrollbars if content overflows.
Mozilla Extensions
- -moz-scrollbars-none
-
Obsolete Use
overflow:hidden
instead. - -moz-scrollbars-horizontal
-
Deprecated
Use of
overflow-x
and
overflow-y
is preferred. - -moz-scrollbars-vertical
-
Deprecated
Use of
overflow-x
and
overflow-y
is preferred. - -moz-hidden-unscrollable
- Is intended mainly for internal use and by themes. Disables scrolling of XML root elements and
<html>
, <body>
by arrow keys and mouse wheel.
Examples
p {
width: 12em;
border: dotted;
overflow: auto; /* append scrollbars if necessary */
}
overflow: hidden
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
overflow: scroll
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
overflow: auto
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
overflow: auto
short text
visible
(default)
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
Notes
Through Gecko 1.9.2 (Firefox 3.6), the overflow
property is incorrectly applied to table-group elements (<thead>
, <tbody>
, <tfoot>
). This behavior is corrected in later versions.
Browser compatibility
Browser | Lowest version |
Internet Explorer |
4.0 [*]
|
Firefox (Gecko) |
1.0 (1.0) |
Opera | 4.0-7.0
|
Safari (WebKit) |
1.0 (85) |
[*] IE 4-6 enlarges an element with overflow:visible
(default value) to fit the content in it. height/width
behaves like min-height/min-width
.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 2.0
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Summary
This value for CSS
background-image
lets you use a portion of a larger image as a background. This allows you to, for example, use different parts of one larger image as backgrounds in different parts of your content.
This works very similarly to the
-moz-image-region
property, which is used with the
list-style-image
property to use parts of an image as the bullets in lists. However, this can be used for any CSS background.
The syntax for the rectangle is similar to the rect()
function generating a
<shape>
CSS type. All four values are relative to the upper left corner of the image.
Syntax
-moz-image-rect(
<uri>
, top, right, bottom, left);
Values
-
<uri>
- The URI of the image from which to take the sub-image.
- top
- The top edge, specified as a
<length>
, of the sub-image within the specified image. - right
- The right edge, specified as a
<length>
, of the sub-image within the specified image. - bottom
- The bottom edge, specified as a
<length>
, of the sub-image within the specified image. - left
- The left edge, specified as a
<length>
, of the sub-image within the specified image.
Example
This example loads an image and uses it in four segments to draw the Firefox logo in four
<div>
blocks. Clicking on their container causes the four segments to rotate around by swapping the
background-image
property values among the four
<div>
blocks.
CSS
The CSS defines one container style, then the styles for the four boxes that comprise the complete image.
The container looks like this:
#container {
width:400px;
height:400px;
top:100px;
left:100px;
position:absolute;
font-size:16px;
text-shadow:white 0px 0px 6px;
text-align:center;
}
Then the four boxes defining the segments of the image are defined. Let's look at them one at a time.
#box1 {
background-image: -moz-image-rect(url(firefox.jpg), 0%, 50%, 50%, 0%);
width:200px;
height:200px;
position:absolute;
}
This is the top-left corner of the image. It defines a rectangle containing the top-left quarter of the image in the file firefox.jpg
.
#box2 {
background-image: -moz-image-rect(url(firefox.jpg), 0%, 100%, 50%, 50%);
width:200px;
height:200px;
position:absolute;
}
This defines the top-right corner of the image.
The other corners follow a similar pattern:
#box3 {
background-image: -moz-image-rect(url(firefox.jpg), 50%, 50%, 100%, 0%);
width:200px;
height:200px;
position:absolute;
}
#box4 {
background-image: -moz-image-rect(url(firefox.jpg), 50%, 100%, 100%, 50%);
width:200px;
height:200px;
position:absolute;
}
HTML
The HTML is quite simple:
<div id="container" onclick="rotate()">
<div id="box1" style="left:0px;top:0px;">Top left</div>
<div id="box2" style="left:200px;top:0px;">Top right</div>
<div id="box3" style="left:0px;top:200px;">Bottom left</div>
<div id="box4" style="left:200px;top:200px;">Bottom right</div>
</div>
This places the four segments of our image in a two-by-two box grid. These four segments are all contained within a larger
<div>
block whose primary purpose is to receive click events and dispatch them to our JavaScript code.
The JavaScript code
This code handles the click event when the container receives a mouse click.
function rotate() {
var prevStyle = window.getComputedStyle(document.getElementById("box4"), null).getPropertyValue("background-image");
// Now that we've saved the last one, start rotating
for (var i=1; i<=4; i++) {
var curId = "box" + i;
// Shift the background iamges
var curStyle = window.getComputedStyle(document.getElementById(curId), null).getPropertyValue("background-image");
document.getElementById(curId).style.backgroundImage = prevStyle;
prevStyle = curStyle;
}
}
This uses
window.getComputedStyle()
to fetch the style of each element, shifting it to the following element. Notice that before it begins doing so it saves a copy of the last box's style since it will be overwritten by the third element's style. By simply copying the values of the
background-image
property from one element to the next with each mouse click, we achieve the desired effect.
What it looks like
Here's what the display looks like when first loaded:

After clicking it once:

After the second click:

And after the third click:

Another click rotates it back around to what it originally looked like.
View the live example
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
For certain XUL elements and pseudo-elements that use an image from the
list-style-image
property, this property specifies a region of the image that is used in place of the whole image. This allows elements to use different pieces of the same image to improve performance.
The syntax is similar to the
clip
property. All four values are relative to the upper left corner of the image.
Syntax
-moz-image-region: rect(top, right, bottom, left);
Examples
#example-button {
/* display only the 4x4 area from the top left of this image */
list-style-image: url("chrome://example/skin/example.png");
-moz-image-region: rect(0px, 4px, 4px, 0px);
}
#example-button:hover {
/* use the 4x4 area to the right of the first for the hovered button */
-moz-image-region: rect(0px, 8px, 4px, 4px);
}
This is an experimental feature
Because this feature is still in development in some browsers, check the compatibility table for the proper prefixes to use in various browsers.
Gradients are smooth transitions between two or more specified colors. Use of CSS gradients can replace images and reduce download time, create a more flexible layout, and look better while zooming. Mozilla (Firefox) supports two kinds of CSS gradients: linear and radial.
Mozilla currently only supports CSS gradients as values of the
background-image
property, as well as within the shorthand
background
. You specify a gradient value instead of an image URL.
The linear-gradient
value does not allow repeating gradients. For this functionality, see
repeating-linear-gradient
.
Syntax
linear-gradient( [<point> || <angle>,]? <stop>, <stop> [, <stop>]* )
Vendor prefixes: See the compatibility table below for detail on the vendor prefixes you'll need to use for gradients.
Where:
- <stop>
-
<color>
[
<percentage>
|
<length>
]
Values
- <point>
- A position, interpreted in the same way as
background-position
or
-moz-transform-origin
. This is used to define the starting point of the gradient. It can be specified as a percentage, in pixels, or using "left", "center", or "right" for horizontal and "top", "center", or "bottom" for vertical positioning. Positions start from the top left corner of the affected element. If only one of the horizontal or vertical positioning is specified, the other direction defaults to "center". - <angle>
- An angle of direction for the gradient. See
<angle>
. - <stop>
- This value is comprised of a
<color>
value, followed by an optional stop position (either a percentage between 0% and 100% or a
<length>
along the gradient axis). - Rendering of color-stops in CSS gradients follows the same rules as color-stops in SVG gradients.
Examples
Linear gradients run along an axis. The axis is defined in the following ways:
- If the first parameter to the gradient function is only a <point>, the gradient axis starts from the specified point, and ends at the point you would get if you rotated the starting point by 180 degrees about the center of the box that the gradient is to be applied to.
- If the first parameter is only an <angle>, the gradient axis starts from the box's corner that would ensure the axis goes through the box. The axis runs along the specified angle. The end point of the axis is defined such that the farthest corner of the box from the starting point is perpendicular to the gradient axis at that point.
- If the first parameter has both a <point> and <angle>, the gradient axis starts from the point and runs along the angle. The end point is defined as before.
- If neither a <point> or <angle> is specified, i.e. the entire function consists of only <stop> values, the gradient axis starts from the top of the box and runs vertically downwards, ending at the bottom of the box.
Positions can be specified along the gradient axis with a color for each of them, called "color-stops", and the areas between every color-stop smoothly transition between each other. Any one color in the gradient forms a straight line that is perpendicular to the gradient axis. In the below image, the gradient's axis starts from the top-left corner of the div, and is directed at a 45 degree angle. Two color-stops are specified, red and blue.

Example: Multiple color stops
If the first color-stop does not have a <length>
or <percentage>
, it defaults to 0%. If the last color-stop does not have a <length>
or <percentage>
, it defaults to 100%. If a color-stop doesn't have a specified position and it isn't the first or last stop, then it is assigned the position that is half way between the previous stop and next stop.
Color-stops must be specified in order. After assigning default values to the first and last stops if necessary, if a color-stop has a specified position that is less than the specified position of any color-stop before it in the list, its position is changed to be equal to the largest specified position of any color-stop before it.
A rainbow made from a gradient
background-image: linear-gradient(left, red, orange, yellow, green, blue, indigo, violet);
Examples: Repeating
The linear-gradient
does not allow repeating gradients. By default, the gradient will stretch to fill the element it is defined on. For this functionality, see
repeating-linear-gradient
.
Example: Using transparency
Linear with transparency
background-image: linear-gradient(top left, red, rgba(255,0,0,0));
Gradient backgrounds are not affected by
background-size
if all points and lengths are specified using fixed units (as opposed to percentages or keywords, which are relative to the value of background-size
).
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 3.6 (1.9.2)
-moz
bug 479220
| 10.0 (534.16)
-webkit
| 10.0
-ms
| 11.10
-o
| 5.1
-webkit
|
Legacy syntaxNon-standard | -- | 3
-webkit
| -- | -- | 4.0
-webkit
|
Cross-browser gradients
Considering all prefixes above, here is a gradient from pink to green, top to bottom. (Code taken from css3please.com)
.grad {
background-color: #F07575; /* fallback color if gradients are not supported */
background-image: -webkit-gradient(linear, left top, left bottom, from(hsl(0, 80%, 70%)), to(#BADA55));
background-image: -webkit-linear-gradient(top, hsl(0, 80%, 70%), #BADA55);
background-image: -moz-linear-gradient(top, hsl(0, 80%, 70%), #BADA55);
background-image: -ms-linear-gradient(top, hsl(0, 80%, 70%), #BADA55);
background-image: -o-linear-gradient(top, hsl(0, 80%, 70%), #BADA55);
background-image: linear-gradient(to bottom, hsl(0, 80%, 70%), #BADA55); /* current standard, but unimplemented and subject to change */
}
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
In left to right (LTR) situations, the -moz-margin-end
CSS property specifies the right margin and is synonymous with
margin-right
. In RTL cases it sets the left margin (same as
margin-left
).
In Right to Left (RTL) situations -moz-margin-end
flips the elements margin without having to specify absolute left or right.
-
Initial value
: 0
- Applies to: all elements except those with table display types other than
table-caption
, table
, and inline-table
-
Inherited
: no
- Percentages: refer to
width
of closest block-level ancestor - Media:
visual
-
Computed value
: The percentage as specified or the absolute length
Values
- <length>
- Specifies a fixed width.
- <percentage>
- A percentage with respect to the width of the containing block.
Examples
.content {-moz-margin-end: 5%}
.sidebox {-moz-margin-end: 10px}
Specifications
Not (yet) candidate for specifications.
Browser compatibility
Browser | Lowest Version | Support of |
Internet Explorer | --- | --- |
Firefox (Gecko) | 1.0 (1.7) | -moz-margin-end |
Opera | --- | --- |
Safari (WebKit) | --- | --- |
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
In left to right (LTR) situations the -moz-margin-start
CSS property specifies the left margin and is synonymous with
margin-left
. In RTL cases it sets the right margin (same as
margin-right
).
In Right to Left (RTL) situations -moz-margin-start
flips the elements margin without having to specify absolute left or right.
-
Initial value
: 0
- Applies to: all elements except those with table display types other than
table-caption
, table
, and inline-table
-
Inherited
: no
- Percentages: refer to
width
of closest block-level ancestor - Media:
visual
-
Computed value
: the percentage as specified or the absolute length
Values
- <length>
- Specifies a fixed width.
- <percentage>
- a percentage with respect to the width of the containing block.
Examples
-moz-margin-start:33%; -webkit-margin-start:33%;
direction:rtl; -moz-margin-start:33%; -webkit-margin-start:33%;
Specifications
Not (yet) candidate for specifications.
Browser compatibility
Browser | Lowest Version | Support of |
Internet Explorer | --- | --- |
Firefox (Gecko) | 1.0 (1.7) | -moz-margin-start |
Opera | --- | --- |
Safari (WebKit) | 2.0 (412) | -khtml-margin-start |
3.0 (522) | -khtml-margin-start | -webkit-margin-start |
« CSS « CSS Reference
Syntax
-moz-mask: <uri> | none | inherit
Examples
.target { -moz-mask: url(#c1); }
.anothertarget { -moz-mask: url(resources.svg#c1); }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | ? | ? | ? | ? | ? |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
Specifies the orientation of the element to which it's applied.
Syntax
orient: horizontal | vertical
Values
horizontal
- The element is rendered horizontally.
vertical
- The element is rendered vertically.
Examples
This example displays two progress bars; one horizontal and one vertical.
<html>
<head>
<title>orient example</title>
<style type="text/css">
.vert {
-moz-orient: vertical;
width: 16px;
height: 150px;
}
</style>
</head>
<body>
<p>The following progress meter is horizontal (the default):</p>
<progress max="100" value="75"></progress>
<p>The following progress meter is vertical:</p>
<progress class="vert" max="100" value="75"></progress>
</body>
</html>
View the live example

Specifications
- Not part of any specification; currently, this is a Mozilla-specific extension (that is,
-moz-orient
).
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | -- | 6.0 (6.0)
| -- | -- | -- |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | -- | 6.0 (6.0)
| -- | -- | -- |
Gecko notes
In Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3)
, there's a bug that causes vertical
<progress>
elements to render with the dimensions of a horizontal bar. This is fixed in Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4)
.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
In Mozilla applications, -moz-outline-radius-bottomleft
sets the rounding of the bottom-left corner of the outline.
See the -moz-outline-radius property for more information.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
In Mozilla applications, -moz-outline-radius-bottomright
sets the rounding of the bottom-right corner of the outline.
See the -moz-outline-radius property for more information.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Syntax
-moz-outline-radius: <outline-radius>{1,4} [ / <outline-radius>{1,4}]? | inherit
Values
Elliptical outlines and
<percentage>
values follow the syntax described in
border-radius
.
One, two, three or four <outline-radius>
values, represents one of:
- <length>
- See
<length>
for possible values - <percentage>
- A
<percentage>
; see
border-radius
for details
-
One single value applies to all 4 corners
-
Two values apply to 1. topLeft and bottomRight and 2. to the topRight and bottomLeft corner
-
Three values apply to 1. topLeft, 2. topRight and bottomLeft and 3. to the bottomRight corner
-
Four values apply to 1. topLeft, 2. topRight, 3. bottomRight and 4. to the bottomLeft corner
Examples
outline: dotted red;
-moz-outline-radius: 12% 1em 25px;
/* is equivalent to: */
-moz-outline-radius-topleft: 12%;
-moz-outline-radius-topright: 1em;
-moz-outline-radius-bottomright: 35px;
-moz-outline-radius-bottomleft: 1em;
Notes
-
dotted
or dashed
radiused corners are rendered as solid,
bug 382721
- Future versions of Gecko/Firefox may drop this property completely. See
bug 593717
(remove
-moz-outline-radius
and make outlines follow border-radius
)
Specifications
This property it is not defined in any CSS standard.
Browser compatibility
Support since Firefox 1.5 (Gecko 1.8). There is no correlative property in other major Browsers.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
In Mozilla applications, -moz-outline-radius-topleft
sets the rounding of the top-left corner of the outline.
See the -moz-outline-radius property for more information.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
In Mozilla applications, -moz-outline-radius-topright
sets the rounding of the top-right corner of the outline.
See the -moz-outline-radius property for more information.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
-moz-padding-end
specifies the logical end padding for an element. The computed value of the element's direction
property then determines how the padding is translated to a physical padding. If the computed direction is left-to-right (ltr) then -moz-padding-end
sets the right padding; otherwise it sets the left padding.
See also
-moz-padding-start
-
Initial value
: 0
- Applies to: all elements except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column
-
Inherited
: no
- Percentages: refer to
width
of closest block-level ancestor - Media:
visual
-
Computed value
: the percentage as specified or the absolute length
Values
-
<length>
- Specifies a fixed width.
-
<percentage>
- a percentage with respect to the width of the containing block.
Examples
View Live Examples
.content {
-moz-padding-end: 5%;
}
.sidebox {
-moz-padding-end: 10px;
}
Notes
Browser Compatibility
Browser | Lowest version |
Internet Explorer | -- |
Firefox (Gecko) | Firefox 3 (1.9) (-moz-padding-start)
|
Opera | -- |
Safari | Chrome | WebKit | 3 | 2 | 528.17 (-webkit-padding-start) |
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
-moz-padding-start
specifies the logical start padding for an element. The computed value of the element's direction
property then determines how the padding is translated to a physical padding. If the computed direction is left-to-right ("ltr") then -moz-padding-start
sets the left padding; otherwise it sets the right padding.
See also
-moz-padding-end
-
Initial value
: 0
- Applies to: all elements except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column
-
Inherited
: no
- Percentages: refer to
width
of closest block-level ancestor - Media:
visual
-
Computed value
: the percentage as specified or the absolute length
Values
-
<length>
- Specifies a fixed width.
-
<percentage>
- A percentage with respect to the width of the containing block.
Examples
View Live Examples
.content {
-moz-padding-start: 5%;
}
.sidebox {
-moz-padding-start: 10px;
}
Notes
Browser Compatibility
Browser | Lowest version |
Internet Explorer | -- |
Firefox (Gecko) | Firefox 3 (1.9) (-moz-padding-start)
|
Opera | -- |
Safari | Chrome | WebKit | 3 | 2 | 528.17 (-webkit-padding-start) |
This is an experimental feature
Because this feature is still in development in some browsers, check the compatibility table for the proper prefixes to use in various browsers.
Gradients are smooth transitions between two or more specified colors. Use of CSS gradients can replace images and reduce download time, create a more flexible layout, and look better while zooming. There are two major kinds of CSS gradients: linear and radial.
Modern browsers currently support CSS gradients as values of the
background-image
property, as well as within the shorthand
background
. You specify a gradient value instead of an image URL.
The radial-gradient
property does not allow repeating gradients. For this functionality, see
repeating-radial-gradient
.
Syntax
radial-gradient( [<position> || <angle>,]? [<shape> || <size>,]? <stop>, <stop>[, <stop>]* )
Values
- <position>
- A position, interpreted in the same way as
background-position
or
transform-origin
. If omitted, the default is center
. - <angle>
- An angle establishing the gradient line, which extends from the starting point at this angle; this is
0deg
by default. - <shape>
- The gradient's shape. This is one of
circle
(meaning that the gradient's shape is a circle with constant radius) or ellipse
(meaning that the shape is an axis-aligned ellipse). The default value is ellipse
. - <size>
- The size of the gradient. This is one of the Size constants listed below.
- <stop>
- This value is comprised of a
<color>
value, followed by an optional stop position (either a percentage between 0% and 100% or a
<length>
along the gradient axis). - Rendering of color-stops in CSS gradients follows the same rules as color-stops in SVG gradients.
Size constants
Constant | Description |
closest-side
| The gradient's shape meets the side of the box closest to its center (for circles) or meets both the vertical and horizontal sides closest to the center (for ellipses). |
closest-corner | The gradient's shape is sized so it exactly meets the closest corner of the box from its center. |
farthest-side | Similar to closest-side, except the shape is sized to meet the side of the box farthest from its center (or vertical and horizontal sides). |
farthest-corner
| The gradient's shape is sized so it exactly meets the farthest corner of the box from its center. |
contain
| A synonym for closest-side . |
cover
| A synonym for farthest-corner . |
Usage
Radial gradients also run along an axis. At each end point of the axis, a radius is specified. This can be imagined as creating two "circles", where for each circle the center is specified by the point and the radius is specified by the radius length. The gradient runs outwards from the circumference of the inner circle to the circumference of the outer circle.
background-image: -moz-radial-gradient(center 45deg, circle closest-side, orange 0%, red 100%);
background-image: -webkit-radial-gradient(center 45deg, circle closest-side, orange 0%, red 100%);
background-image: -ms-radial-gradient(center 45deg, circle closest-side, orange 0%, red 100%);
background-image: -o-radial-gradient(center 45deg, circle closest-side, orange 0%, red 100%);
Examples
For a more general introduction to how CSS gradients in Gecko/Firefox work, see
-moz-linear-gradient
.
background: -moz-radial-gradient(45px 45px 45deg, circle cover,
aqua 0%, rgba(0, 0, 255, 0) 100%, blue 95%);
background: -webkit-radial-gradient(45px 45px 45deg, circle cover,
aqua 0%, rgba(0, 0, 255, 0) 100%, blue 95%);
background: -ms-radial-gradient(45px 45px 45deg, circle cover,
aqua 0%, rgba(0, 0, 255, 0) 100%, blue 95%);
background: -o-radial-gradient(45px 45px 45deg, circle cover,
aqua 0%, rgba(0, 0, 255, 0) 100%, blue 95%);
background-image: -webkit-radial-gradient(45px 45px, ellipse farthest-corner,
aqua 0%, rgba(0, 0, 255, 0) 100%, blue 95%);
background-image: -moz-radial-gradient(45px 45px, ellipse farthest-corner,
aqua 0%, rgba(0, 0, 255, 0) 100%, blue 95%);
background-image: -ms-radial-gradient(45px 45px, ellipse farthest-corner,
aqua 0%, rgba(0, 0, 255, 0) 100%, blue 95%);
background-image: -o-radial-gradient(45px 45px, ellipse farthest-corner,
aqua 0%, rgba(0, 0, 255, 0) 100%, blue 95%);
Radial
background: -webkit-radial-gradient(45px 45px, cover, rgb(255, 0, 0) 0%, rgb(0, 0, 255) 100%);
background: -moz-radial-gradient(45px 45px, cover, rgb(255, 0, 0) 0%, rgb(0, 0, 255) 100%);
background: -ms-radial-gradient(45px 45px, cover, rgb(255, 0, 0) 0%, rgb(0, 0, 255) 100%);
background: -o-radial-gradient(45px 45px, cover, rgb(255, 0, 0) 0%, rgb(0, 0, 255) 100%);
Browser compatibility
Browser | Lowest version | Support of |
Internet Explorer | 5.5 (including 8.0) | filter: progid:DXImageTransform.Microsoft.Gradient() MSDN library, gradient filter |
10 | -ms-radial-gradient() |
Firefox (Gecko) | 3.6 (1.9.2) | -moz-radial-gradient() |
Opera | 12 [1]
| -o-radial-gradient() |
Safari / WebKit / Chrome | 4.0 / 528 / 3 |
-webkit-gradient(radial, … ) Safari Reference Library, gradients
|
| 6 / r75891 / 10 |
-webkit-radial-gradient() Safari: CSS3 Gradients Note: unlike Gecko, WebKit supports explicitly sized gradients. See
bug 627885
|
Note that the Mozilla syntax proposal for CSS gradients differs significantly from WebKit's original proposal:
- Gecko (Firefox) uses separate kinds of property values to distinguish radial and linear gradients, whereas WebKit previously lumped them into a single kind of property value and needs a leading parameter to identify the type of gradient.
- The actual syntax for how a radial gradient is specified is significantly different.
- Webkit, Mozilla, Opera and Microsoft now implement the previous version of the W3C standard syntax. The syntax has been changed as of October 2011. The new proposed syntax is not supported in any browser.
« CSS « CSS Reference
Summary
The overflow
CSS property specifies whether to clip content, render scroll bars or display overflow content of a block-level element.
Syntax
overflow: visible | hidden | scroll | auto |
inherit
Values
- visible
- Default value. Content is not clipped, it may be rendered outside the content box.
- hidden
- The content is clipped and no scrollbars are provided.
- scroll
- The content is clipped and desktop browsers use scrollbars, whether or not any content is clipped. This avoids any problem with scrollbars appearing and disappearing in a dynamic environment. Printers may print overflowing content.
- auto
- Depends on the user agent. Desktop browsers like Firefox provide scrollbars if content overflows.
Mozilla Extensions
- -moz-scrollbars-none
-
Obsolete Use
overflow:hidden
instead. - -moz-scrollbars-horizontal
-
Deprecated
Use of
overflow-x
and
overflow-y
is preferred. - -moz-scrollbars-vertical
-
Deprecated
Use of
overflow-x
and
overflow-y
is preferred. - -moz-hidden-unscrollable
- Is intended mainly for internal use and by themes. Disables scrolling of XML root elements and
<html>
, <body>
by arrow keys and mouse wheel.
Examples
p {
width: 12em;
border: dotted;
overflow: auto; /* append scrollbars if necessary */
}
overflow: hidden
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
overflow: scroll
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
overflow: auto
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
overflow: auto
short text
visible
(default)
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
Notes
Through Gecko 1.9.2 (Firefox 3.6), the overflow
property is incorrectly applied to table-group elements (<thead>
, <tbody>
, <tfoot>
). This behavior is corrected in later versions.
Browser compatibility
Browser | Lowest version |
Internet Explorer |
4.0 [*]
|
Firefox (Gecko) |
1.0 (1.0) |
Opera | 4.0-7.0
|
Safari (WebKit) |
1.0 (85) |
[*] IE 4-6 enlarges an element with overflow:visible
(default value) to fit the content in it. height/width
behaves like min-height/min-width
.
« CSS « CSS Reference
Summary
The overflow
CSS property specifies whether to clip content, render scroll bars or display overflow content of a block-level element.
Syntax
overflow: visible | hidden | scroll | auto |
inherit
Values
- visible
- Default value. Content is not clipped, it may be rendered outside the content box.
- hidden
- The content is clipped and no scrollbars are provided.
- scroll
- The content is clipped and desktop browsers use scrollbars, whether or not any content is clipped. This avoids any problem with scrollbars appearing and disappearing in a dynamic environment. Printers may print overflowing content.
- auto
- Depends on the user agent. Desktop browsers like Firefox provide scrollbars if content overflows.
Mozilla Extensions
- -moz-scrollbars-none
-
Obsolete Use
overflow:hidden
instead. - -moz-scrollbars-horizontal
-
Deprecated
Use of
overflow-x
and
overflow-y
is preferred. - -moz-scrollbars-vertical
-
Deprecated
Use of
overflow-x
and
overflow-y
is preferred. - -moz-hidden-unscrollable
- Is intended mainly for internal use and by themes. Disables scrolling of XML root elements and
<html>
, <body>
by arrow keys and mouse wheel.
Examples
p {
width: 12em;
border: dotted;
overflow: auto; /* append scrollbars if necessary */
}
overflow: hidden
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
overflow: scroll
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
overflow: auto
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
overflow: auto
short text
visible
(default)
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
Notes
Through Gecko 1.9.2 (Firefox 3.6), the overflow
property is incorrectly applied to table-group elements (<thead>
, <tbody>
, <tfoot>
). This behavior is corrected in later versions.
Browser compatibility
Browser | Lowest version |
Internet Explorer |
4.0 [*]
|
Firefox (Gecko) |
1.0 (1.0) |
Opera | 4.0-7.0
|
Safari (WebKit) |
1.0 (85) |
[*] IE 4-6 enlarges an element with overflow:visible
(default value) to fit the content in it. height/width
behaves like min-height/min-width
.
« CSS « CSS Reference
Summary
The overflow
CSS property specifies whether to clip content, render scroll bars or display overflow content of a block-level element.
Syntax
overflow: visible | hidden | scroll | auto |
inherit
Values
- visible
- Default value. Content is not clipped, it may be rendered outside the content box.
- hidden
- The content is clipped and no scrollbars are provided.
- scroll
- The content is clipped and desktop browsers use scrollbars, whether or not any content is clipped. This avoids any problem with scrollbars appearing and disappearing in a dynamic environment. Printers may print overflowing content.
- auto
- Depends on the user agent. Desktop browsers like Firefox provide scrollbars if content overflows.
Mozilla Extensions
- -moz-scrollbars-none
-
Obsolete Use
overflow:hidden
instead. - -moz-scrollbars-horizontal
-
Deprecated
Use of
overflow-x
and
overflow-y
is preferred. - -moz-scrollbars-vertical
-
Deprecated
Use of
overflow-x
and
overflow-y
is preferred. - -moz-hidden-unscrollable
- Is intended mainly for internal use and by themes. Disables scrolling of XML root elements and
<html>
, <body>
by arrow keys and mouse wheel.
Examples
p {
width: 12em;
border: dotted;
overflow: auto; /* append scrollbars if necessary */
}
overflow: hidden
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
overflow: scroll
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
overflow: auto
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
overflow: auto
short text
visible
(default)
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
Notes
Through Gecko 1.9.2 (Firefox 3.6), the overflow
property is incorrectly applied to table-group elements (<thead>
, <tbody>
, <tfoot>
). This behavior is corrected in later versions.
Browser compatibility
Browser | Lowest version |
Internet Explorer |
4.0 [*]
|
Firefox (Gecko) |
1.0 (1.0) |
Opera | 4.0-7.0
|
Safari (WebKit) |
1.0 (85) |
[*] IE 4-6 enlarges an element with overflow:visible
(default value) to fit the content in it. height/width
behaves like min-height/min-width
.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Don't use this value! Use the cursor
value
progress
instead.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 1.9.1
(Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)
Summary
-moz-stack-sizing
is an extended CSS property. Normally, a
stack
will change its size so that all of its child elements are completely visible. For example, moving a child of the stack far to the right will widen the stack so the child remains visible.
If you wish to prevent the stack from resizing automatically to accommodate its children, you can set -moz-stack-sizing
to ignore
on the child element. The property is set not on the stack itself, but on the stack's children. This lets you ignore certain children, but not others.
Syntax
-moz-stack-sizing: ignore | stretch-to-fit
Values
- stretch-to-fit
- The child will influence the stack's size.
- ignore
- The stack won't consider this child when calculating the its size.
Examples
View Live Examples (not available, please check later)
.mainsheet{
-moz-stack-sizing: ignore;
}
Notes
In previous versions of Gecko it was possible to work around the problem by setting very large negative bottom and right margins on the stack element and equally large positive bottom and right margins on the children whose size you didn't want to ignore. (The problem does not affect children moved above or to the left of the stack.)
Summary
The tab-size
CSS property is used to customize the width of a tab (U+0009
) character.
Syntax
tab-size: <integer> | inherit
Values
-
<integer>
- The number of spaces in a tab. Must be positive.
- inherit
- Inherits from the parent element.
Examples
pre {
tab-size: 99; /* Don't use tabs! */
}
Browser compatibility
Browser | Lowest Version | Support of |
Internet Explorer | --- | --- |
Firefox | 4.0 (Gecko 2.0) | -moz-tab-size |
Opera | 10.60 | -o-tab-size |
Safari (WebKit) | --- | --- |
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
The -moz-text-blink
non-standard Mozilla CSS extension specifies the blink mode.
Syntax
-moz-text-blink: none | blink
Values
- none
- Produces no blinking.
- blink
- Text blinks. Note that not blinking the text is one technique to satisfy checkpoint 3.3 of WAI-UAAG.
Examples
.example {
-moz-text-blink: blink;
}
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 6.0 (6.0)
| -- | -- | -- | -- |
Feature | Firefox Mobile (Gecko) | Android | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | -- | -- | -- | -- |
« CSS « CSS Reference
Summary
The transform
CSS property lets you modify the coordinate space of the CSS visual formatting model. Using it, elements can be translated, rotated, scaled, and skewed as this text.
Syntax
transform: <transform-function> [<transform-function>]* | none
Vendor prefixes: See the compatibility table below for detail on the vendor prefixes you'll need to use for this feature.
Values
- transform-function
- One or more of the CSS transform functions to be applied, see below.
- none
- Specifies that no transform should be applied.
Examples
See Using CSS transforms.
Live Example
pre {
width: 33em;
border: solid red;
-moz-transform: translate(100px) rotate(20deg);
-moz-transform-origin: 60% 100%;
-webkit-transform: translate(100px) rotate(20deg);
-webkit-transform-origin: 60% 100%;
-o-transform:translate(100px) rotate(20deg);
-o-transform-origin:60% 100%;
-ms-transform: translate(100px) rotate(20deg);
-ms-transform-origin: 60% 100%;
transform: translate(100px) rotate(20deg);
transform-origin: 60% 100%;
}
CSS transform functions
The transform
CSS property allows the coordinate system used by an element to be manipulated using transform functions. These functions are described below.
matrix
transform: matrix(a, c, b, d, tx, ty)
/* Where a, b, c, d build the transformation matrix
┌ ┐
│ a b │
│ c d │
└ ┘
and tx, ty are the translate values. */
Specifies a 2D transformation matrix comprised of the specified six values. This is the equivalent to applying the transformation matrix [a b c d tx ty].
Note: Gecko (Firefox) accepts a
<length>
value for
tx and
ty.
Webkit (Safari, Chrome) and Opera currently support a unitless
<number>
for
tx and
ty.
Live Examples
background: gold; width: 30em;
-moz-transform: matrix(1, -0.2, 0, 1, 0, 0);
-webkit-transform: matrix(1, -0.2, 0, 1, 0, 0);
-o-transform: matrix(1, -0.2, 0, 1, 0, 0);
-ms-transform: matrix(1, -0.2, 0, 1, 0, 0);
transform: matrix(1, -0.2, 0, 1, 0, 0);
background: wheat;
max-width: intrinsic;
-moz-transform: matrix(1, 0, 0.6, 1, 15em, 0);
-webkit-transform: matrix(1, 0, 0.6, 1, 250, 0);
-o-transform: matrix(1, 0, 0.6, 1, 250, 0);
-ms-transform: matrix(1, 0, 0.6, 1, 250, 0);
transform: matrix(1, 0, 0.6, 1, 250, 0);
rotate
transform: rotate(angle); /* an <angle>, e.g. rotate(30deg) */
Rotates the element clockwise around its origin (as specified by the
transform-origin
property) by the specified angle
. The operation corresponds to the matrix [cos(angle) sin(angle) -sin(angle) cos(angle) 0 0].
scale
transform: scale(sx[, sy]); /* one or two unitless <number>s, e.g. scale(2.1,4) */
Specifies a 2D scaling operation described by [sx, sy]. If sy
isn't specified, it is assumed to be equal to sx
.
scaleX
transform: scaleX(sx); /* a unitless <number>, e.g. scaleX(2.7) */
Specifies a scale operation using the vector [sx, 1].
scaleY
transform: scaleY(sy) /* a unitless <number>, e.g. scaleY(0.3) */
Specifies a scale operation using the vector [1, sy].
skew
transform: skew(ax[, ay]) /* one or two <angle>s, e.g. skew(30deg,-10deg) */
Skews the element around the X and Y axes by the specified angles. If ay
isn't provided, no skew is performed on the Y axis.
skewX
transform: skewX(angle) /* an <angle>, e.g. skewX(-30deg) */
Skews the element around the X axis by the given angle
.
skewY
transform: skewY(angle) /* an <angle>, e.g. skewY(4deg) */
Skews the element around the Y axis by the given angle
.
translate
transform: translate(tx[, ty]) /* one or two <length> values */
Specifies a 2D translation by the vector [tx, ty]. If ty
isn't specified, its value is assumed to be zero.
translateX
transform: translateX(tx) /* see <length> for possible values */
Translates the element by the given amount along the X axis.
translateY
transform: translateY(ty) /* see <length> for possible values */
Translates the element by the given amount along the Y axis.
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 3.5 (1.9.1)
-moz
| yes
-webkit
| 9.0
-ms
| 10.5
-o
| 3.1
-webkit
|
3D Support | 10.0
-moz
| 12.0
-webkit
| 10.0
-ms
| no | 4.0
-webkit
|
Feature | iOS Safari | Opera Mini | Opera Mobile | Android Browser |
Basic support | ? | ? | ? | ? |
Notes
Internet Explorer 5.5 or later supports a proprietary Matrix Filter which can be used to achieve the similar effect.
Summary
The transform-origin
CSS property lets you modify the origin for transformations of an element. For example, the transform-origin of the rotate()
function is the centre of rotation. (This property is applied by first translating the element by the negated value of the property, then applying the element's transform, then translating by the property value.)
-
Initial value
:
50% 50%
- Applies to: all block level and inline level elements
-
Inherited
: no
- Percentages: refer to the size of the box itself
- Media:
visual
-
Computed value
: for
<length>
the absolute value, otherwise a percentage
Syntax
transform-origin: [ <percentage> | <length> | left | center | right ]
[ <percentage> | <length> | top | center | bottom ] ?
transform-origin: [ left | center | right ] || [ top | center | bottom ]
Values
Accepts one or two values.
- One single value sets the horizontal position, the vertical position is set to
50%
. - Two values apply first to the horizontal and second to the vertical position.
Combinations are allowed of keyword,
<length>
, or
<percentage>
values, but if keywords are mixed with other values, left
and right
may only be used as the first value, and top
and bottom
may only be used as the second value. Negative positions are allowed.
- <percentage>
- With a value pair of
0% 0%
, (or just 0 0
) the transform-origin is the upper left corner of the box. A value pair of 100% 100%
places the transform-origin to the lower right corner. With a value pair of 14% 84%
, the point 14% across and 84% down the box is the transform-origin. - <length>
- With a value pair of e.g.
2cm 1cm
, the transform-origin is placed 2cm to the right and 1cm below the upper left corner of the element. - top left | left top
- Same as
0 0
- top | top center | center top
- Same as
50% 0
- right top | top right
- Same as
100% 0
- left | left center | center left
- Same as
0 50%
- center | center center
- Same as
50% 50%
(default value) - right | right center | center right
- Same as
100% 50%
- bottom left | left bottom
- Same as
0 100%
- bottom | bottom center | center bottom
- Same as
50% 100%
- bottom right | right bottom
- Same as
100% 100%
Examples
See Using CSS transforms for examples.
Live Examples
transform: none; | |
transform: rotate(30deg); | |
transform: rotate(30deg); transform-origin: 0 0; | |
transform: rotate(30deg); transform-origin: 100% 100%; | |
transform: rotate(30deg); transform-origin: -10em -30em; | |
transform: scale(1.9); | |
transform: scale(1.9); transform-origin: 0 0; | |
transform: scale(1.9); transform-origin: 100% -30%; | |
transform: skew(50deg); | |
transform: skew(50deg); transform-origin: 0 0; | |
transform: skew(50deg); transform-origin: 100% 100%; | |
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 3.5 (1.9.1)
-moz
| yes
-webkit
| 9.0
-ms
| 10.5
-o
| 3.1
-webkit
|
Feature | iOS Safari | Opera Mini | Opera Mobile | Android Browser |
Basic support | ? | ? | ? | ? |
Notes
Internet Explorer 5.5 or later supports a proprietary Matrix Filter which can be used to achieve the similar effect.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 2
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Summary
The -moz-transition-delay
CSS property specifies the amount of time to wait between a change being requested to a property that is to be transitioned and the start of the transition effect.
A value of 0s (or 0ms) indicates that the property will begin to animate its transition immediately when the value changes; positive values will delay the start of the transition effect for the corresponding number of seconds. Negative values cause the transition to begin immediately, but to cause the transition to seem to begin partway through the animation effect.
You may specify multiple delays; each delay will be applied to the corresponding property as specified by the
-moz-transition-property
property.
Note: This implementation of the CSS transition-delay
property is based on a draft specification; the syntax is subject to change.
Syntax
-moz-transition-delay: <time>[, <time>]*
Values
- time
- The time (in seconds or milliseconds) to wait between a property's value changing and the start of the animation effect. A time in seconds is represented by a number followed by "s", while a time in milliseconds is a number followed by "ms".
Examples
There are several examples of CSS transitions included in the main CSS transitions article.
Browser compatibility
Browser | Lowest Version |
Internet Explorer | --- |
Firefox (Gecko) | 4.0 (2.0) |
Opera | --- |
Safari (WebKit) | nightly, don't know version
|
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 2
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Summary
The -moz-transition-duration
CSS property specifies the number of seconds or milliseconds a transition animation should take to complete. By default, the value is 0s, meaning that no animation will occur.
You may specify multiple durations; each duration will be applied to the corresponding property as specified by the
-moz-transition-property
property.
Note: This implementation of the CSS transition-duration
property is based on a draft specification; the syntax is subject to change.
Syntax
-moz-transition-duration: <time>[, <time>]*
Values
- time
- The time (in seconds or milliseconds) the transition from the old value of a property to the new value should take. A time in seconds is represented by a number followed by "s", while a time in milliseconds is a number followed by "ms".
Examples
There are several examples of CSS transitions included in the main CSS transitions article.
Browser compatibility
Browser | Lowest Version |
Internet Explorer | --- |
Firefox (Gecko) | 4.0? (2.0) |
Opera | --- |
Safari (WebKit) | nightly, don't know version |
« CSS « CSS Reference
Introduced in Gecko 2
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Syntax
-moz-transition: [ <transition-property> || <transition-duration> || <transition-timing-function> || <transition-delay> ]
See When property value lists are of different lengths for details on how things are handled when lists of property values aren't the same length. In short, extra transition descriptions beyond the number of properties actually being animated are ignored.
Examples
There are several more examples of CSS transitions included in the main CSS transitions article.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | 1.0 (-webkit-) | 4.0 (2.0)
(-moz-) | - | 10.5 | 3.0 (-webkit-) |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Introduced in Gecko 2
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Summary
The -moz-transition-property
CSS property is used to specify the names of CSS properties to which a transition effect should be applied.
Note: The set of properties that can be animated is subject to change; as such, you should avoid including any properties in the list that don't currently animate, because someday they might, causing unexpected results.
If you specify a shorthand property (for example,
background
, all of its longhand sub-properties that can be animated will be.
Note: This implementation of the CSS transition-property
property is based on a draft specification; the syntax is subject to change.
Syntax
-moz-transition-property: none | all | [<property-name>][, <property-name>]*
Values
- none
- No properties will transition.
- all
- All properties that can have an animated transition will do so.
- property-name
- A property to which a transition effect should be applied when its value changes.
Examples
There are several examples of CSS transitions included in the main CSS transitions article.
Browser compatibility
Browser | Lowest Version |
Internet Explorer | --- |
Firefox (Gecko) | 4.0 (2.0) |
Opera | --- |
Safari (WebKit) | nightly, don't know version |
« CSS « CSS Reference
Summary
The transition-timing-function
CSS property is used to describe how the intermediate values of the CSS properties being affected by a transition effect are calculated. This in essence lets you establish an acceleration curve, so that the speed of the transition can vary over its duration.
This acceleration curve is defined using one
<timing-function>
for each property to be transitioned.
Note: This implementation of the CSS transition-timing-function
is based on a draft specification and is therefore experimental : the syntax is subject to change.
Examples
There are several examples of CSS transitions included in the main CSS transitions article.
Browser compatibility
Browser | Lowest Version |
Internet Explorer | --- |
Firefox (Gecko) | 4.0 (2.0)
-moz
|
Opera | --- |
Safari (WebKit) | 3.1
-webkit
|
Used to indicate whether the element can have the focus. By setting this to 'ignore', you can disable focusing the element, which means that the user will not be able to activate the element. The element will be skipped in the tab sequence. A similar property 'user-focus' has been proposed for CSS3.
ignore
- The element does not accept the keyboard focus and will be skipped in the tab order.
normal
- The element can accept the keyboard focus.
Note: This property doesn't work for XUL
textbox
elements, because the
textbox
itself never takes focus. Instead, XBL creates an anonymous HTML
<input>
element inside the
textbox
, and that element is what receives focus. You can stop the
textbox
from taking keyboard focus by setting its tab index to -1, and from taking mouse focus by preventing the default action of
mousedown
events.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
In Mozilla applications, -moz-user-input
determines if an element will accept user input.
-moz-user-input
was one of the proposals leading to the proposed CSS 3
user-input
property, which has not yet reached Candidate Recommendation (call for implementations).
For elements that normally take user input, such as a textarea, the initial value of -moz-user-input
is enabled.
Syntax
-moz-user-input: none | enabled | disabled | inherit
Values
- none
- The element does not respond to user input, and it does not become
:active
. - enabled
- The element accepts user input. For textboxes, this is the default behavior.
- disabled
- The element does not accept user input. However, this is not the same as setting
disabled
to true, in that the element is drawn normally.
Examples
input.example {
/* the user will be able to select the text, but not change it. */
-moz-user-input: disabled;
}
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
The -moz-user-modify
property determines whether or not the content of an element can be edited by a user. This property is related to the contentEditable
attribute.
Syntax
-moz-user-modify: read-only | read-write | write-only
Values
- read-only
- Default value. Contents are read-only.
- read-write
- The user is able to read and write contents.
- write-only
- The user is able to edit the content, but not to read it.
Example
.readwrite {
-moz-user-modify: read-write;
-webkit-user-modify: read-write;
}
<div class="readwrite">The user is able to change this text.</div>
Browser compatibility
Browser | Version | Support of |
Internet Explorer | --- | --- |
Firefox (Gecko) | 1.0 (1.0) | -moz-user-modify |
Opera | --- | --- |
Safari (WebKit) | 3.0 (522) | -webkit-user-modify [*] |
[*] Also supported: -webkit-user-modify: read-write-plaintext-only
(Richtext will be lost).
This property was called -khtml-user-modify
in Safari 2.0.
Controls the appearance (only) of selection. This does not have any affect on actual selection operation. This doesn't have any effect on content loaded as chrome, except in textboxes.
- none
- The text of the element and sub-elements will appear as if they cannot be selected. Any use of Selection however will contain these elements.
- text
- The text can be selected by the user.
- -moz-none
- The text of the element and sub-elements cannot be selected, but selection can be enabled on sub-elements using
-moz-user-select:text
. - all
- In HTML editor, if double-click or context-click occurred in sub-elements, the highest ancestor with this value will be selected.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 1.9.1
(Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)
Summary
-moz-window-shadow
specifies whether a window will have a shadow. Currently it only works on Mac OS X.
Firefox 3 added support for transparent windows on Mac OS X. However, for these windows shadows were turned off and there was no way of turning them on.
In Firefox 3.5 we changed the default; all windows now have a shadow. We introduced the -moz-window-shadow
CSS property to provide a way to turn off unwanted shadows.
Syntax
-moz-window-shadow: default | menu | tooltip | sheet | none
Values
- default
- The window will have a shadow with the default window shadow style.
- menu
Requires Gecko 2.0
- The window will have the shadow style that's appropriate for menus.
- tooltip
Requires Gecko 2.0
- The window will have the shadow style that's appropriate for tooltips.
- sheet
Requires Gecko 2.0
- The window will have the shadow style that's appropriate for sheet windows.
- none
- The window won't have a shadow.
Examples
.KUI-panel {
-moz-window-shadow: none;
}
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
In Mozilla products like Firefox, the -moz-zoom-in
CSS cursor indicates that an element or an object in a webpage is actually being resized, enlarged or is actually being magnified in a DHTML snippet.
The -moz-zoom-in
cursor looks like a magnifying glass with a plus-sign in its centre.
On Windows, it looks like this: 
The natural complementary cursor value for -moz-zoom-in
is -moz-zoom-out.
Together, these 2 cursor values are graphically very intuitive.
- This cursor value is a Mozilla CSS Extension.
- There is no CSS standard for this cursor.
- Support since Gecko 1.4/ Firefox 1.0.
- This cursor is not recommended for use on public web pages. Custom image cursors may provide better cross browser compatibility.
See also:
cursor
,
-moz-zoom-out
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
In Mozilla products like Firefox, the -moz-zoom-in
CSS cursor indicates that an element or an object is actually being resized, reduced or is actually being zoomed out in a DHTML snippet.
The -moz-zoom-out
cursor looks like a magnifying glass with a minus-sign in its centre.
On Windows, it looks like this: 
The natural complementary cursor value for -moz-zoom-out
is -moz-zoom-in.
Together, these 2 cursor values are graphically very intuitive.
- This cursor value is a Mozilla CSS Extension.
- There is no CSS standard for this cursor.
- Support since Gecko 1.4/ Firefox 1.0.
- This cursor is not recommended for use on public web pages. Custom image cursors may provide better cross browser compatibility.
See also:
cursor
,
-moz-zoom-in
« CSS « CSS Reference
Summary
none is a common value for most CSS properties. It is often the default value, but can always be considered as a sort of "standard" value. It is comparable to the value
normal
, used in a similar manner for other properties.
« CSS « CSS Reference
Summary
normal is a common value for some CSS properties. It is often the default value, but can always be considered as a sort of "standard" value. It is comparable to the value
none
, used in a similar manner for other properties.
Used in
-
font-weight
- Gives the font standard weight (400). That is, the text is not noticeably bold or light.
-
font-style
- Does not apply any italic or oblique to the font.
-
word-spacing
- Uses the standard spacing between words, specified by the font.
Also used in:
The <number>
CSS data type represents a number, either integer or fractional. Its syntax extends the one of the
<integer>
data value. To represent a fractional value, add the fractional part — a '.' followed by one or several decimal digits — to any
<integer>
data value. Like for
<integer>
data type, there isn't any unit associated to a <number>
, which is not a CSS dimension.
Interpolation
Values of the <number>
CSS data type can be interpolated in order to allow animations. In that case they are interpolated as real, floating-point, numbers. [1] The speed of the interpolation is determined by the timing function associated with the animation.
Examples
These are valid number values:
12 A raw <integer> is also a <number>
4.01 A positive non-integer <number>
-456.8 Negative non-integer <number>
0.0 Zero
+0.0 Zero, with a leading +
-0.0 Zero, with a leading - (Though strange, this is an allowed value)
These are invalid number values:
12. The dot should be followed by a number
+---12.2 Only one leading +/- is allowed
12.1.1 Only one dot is allowed
10e3 The e notation is not allowed
Browser Compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
basic | 1.0 | 1.0 (1.0) | <=5.0 | yes | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | yes | yes | yes | yes | yes |
See also
-
CSS Reference index
- CSS Data Types :
<angle>
, <color>
, <frequency>
, <identifier>
, <integer>
, <length>
, <number>
, <percentage>
, <ratio>
, <resolution>
, <shape>
, <string>
, <time>
, <timing-function>
, <uri>
« CSS « CSS Reference
Summary
The opacity
CSS property specifies the transparency of an element, that is, the degree to which the background behind the element is overlaid.
Using this property with a value different than 1
places the element in a new stacking context.
Syntax
opacity: <number> | inherit
Values
A
<number>
in the range 0.0
to 1.0
. Any value smaller or larger is clamped to this range.
- 0
- The element is fully transparent (that is, invisible).
-
number between 0 and 1
- The element is translucent (that is, background can be seen).
- 1
- The element is fully opaque (solid).
Examples
hbox.example {
opacity: 0.5; /* see the background through the hbox */
}
Cross Browser compatible Live Example
pre { /* make the box translucent (20% opaque) */
border: solid red;
opacity: 0.2;
filter: alpha(opacity=20); /* IE8 and lower */
zoom: 1; /* set "zoom", "width" or "height" to trigger "hasLayout" in IE 7 and lower */
}
pre { /* make the box translucent (50% opaque) */
border: solid red;
opacity: 0.5;
filter: alpha(opacity=50); /* IE8 and lower */
zoom: 1; /* set "zoom", "width" or "height" to trigger "hasLayout" in IE 7 and lower */
}
pre { /* make the box translucent (80% opaque) */
border: solid red;
opacity: 0.8;
filter: alpha(opacity=80); /* IE8 and lower */
zoom: 1; /* set "zoom", "width" or "height" to trigger "hasLayout" in IE 7 and lower */
}
Different opacity with :hover
<html>
<head>
<style>
img.opacity {
opacity: 1;
filter: alpha(opacity=50);
zoom: 1;
}
img.opacity:hover {
opacity: 0.5;
filter: alpha(opacity=100);
zoom: 1;
}
</style>
</head>
<body>
<img src="//developer.mozilla.org/media/img/mdn-logo.png" alt="MDN logo" width="128" height="146" class="opacity" />
</body>
</html>
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.7)
| 9.0 | 9.0 | 1.2 (125) |
8.0
filter: alpha(opacity=xx) filter: "alpha(opacity=xx)" (both are synonymous) |
4.0
filter: alpha(opacity=xx)
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 1.0 | 1.0 (1.7)
| 9.0 | 9.0 | 3.2 |
8.0
filter: alpha(opacity=xx) filter: "alpha(opacity=xx)" (both are synonymous) |
4.0
filter: alpha(opacity=xx)
|
- Prior to version 9, Internet Explorer does not support
opacity
, rather it supports filter
instead. - IE supports also the extended form
progid:DXImageTransform.Microsoft.Alpha(Opacity=xx)
. This is needless, so don't use it. - IE8 introduced
-ms-filter
, which is synonymous with filter
. Don't use the prefix. - Similar to
-moz-opacity
, -khtml-opacity
has been dead since early 2004 (release of Safari 1.2).
Konqueror never had support for -khtml-opacity
and had been supporting opacity
since version 4.0.
Don't use -khtml-opacity
nor -moz-opacity
anymore.
Summary
The orphans
property refers to the minimum number of lines in a block container that must be left at the bottom of the page. This property is normally used to control how page breaks occur.
Syntax
orphans: <integer> | inherit
Values
Only positive values are allowed.
Browser Compatibility
Browser | Lowest version |
Internet Explorer | IE 8 |
Firefox (Gecko) | -- |
Opera | 9.2 |
Safari | Chrome | WebKit | -- |
« CSS « CSS Reference
Summary
The outline-color
CSS property sets the color of the outline of an element. An outline is a line that is drawn around elements, outside the border edge, to make the element stand out.
Syntax
outline-color: <color> | invert | inherit
Values
- <color>
- See
<color>
for the various color keywords and notations. - invert
- To ensure the outline is visible, performs a color inversion of the background. This makes the focus border more salient, regardless of the color in the background. Currently only supported in Opera and IE8.
Examples
The css code here:
.example {
/* make the outline red */
outline-color: #FF0000;
}
produces the following outline color for a 2px outline:
outline-color is blue.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.5 (1.8) In versions previous to 1.5: -moz-outline-color
| 8.0 | 7.0 | 1.2 (125) |
invert value | -- | Support had been dropped since 3.0 (1.9)
bug 359497
: WONTFIX Workaround: Use the value of the element's color property. | 8.0 | 7.0 | --
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The outline
CSS property is a shorthand property for setting one or more of the individual outline properties
outline-style
,
outline-width
and
outline-color
in a single rule. In most cases the use of this shortcut is preferable and more convenient.
Outlines differ from borders in the following ways:
- Outlines do not take up space, they are drawn above the content.
- Outlines may be non-rectangular. They are rectangular in Gecko/Firefox. But e.g. Opera draws a non-rectangular shape around a construct like this:
TEXTTEXTTEXT
In browsers previous to Gecko 1.8 (Firefox 1.5) a similar effect can be achieved using Mozilla CSS Extension
-moz-outline
.
Syntax
outline: [ <outline-width> || <outline-style> || <outline-color> ] | inherit
Values
One, two or three values, given in arbitrary order:
- outline-width
-
Optional, default value
medium
is used if absent. See
outline-width
. - outline-style
-
Required, default value
none
is used if absent. See
outline-style
. - outline-color
-
Optional, default value if absent:
invert
. Since Gecko 1.9 (Firefox 3), the value of the element's color
property (foreground color) is used. See
outline-color
.
Examples
outline: solid; | outline: dashed red; | outline: dotted 1px; | outline: ridge thick violet; | outline: custom 5px;
/* two identical declarations */
:link:hover { outline: 1px solid #000 }
:link:hover { outline: solid black 1px }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.5 (1.8) | 8.0 | 7.0 | 1.2 (125) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 1.0 | 1.0 (1.8)
| 8.0 | 6.0 | 3.1 |
« CSS « CSS Reference
Summary
The outline-offset
CSS property is used to set space between an
outline
and the edge or border of an element. An outline is a line that is drawn around elements, outside the border edge.
The space will be transparent (the parent will determine the background).
Syntax
outline-offset: <length> | inherit
Values
- <length>
- The width of the space. See
<length>
for possible units. Negative values place the outline inside the element.
Examples
.example {
outline: dashed thin;
/* Move the outline 3px away from the border */
outline-offset: 3px;
}
The code above produces this effect:
outline: offset 5px;
Another example:
outline: multiple offsets;
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 |
1.5 (1.8) | -- | 9.5 |
1.2 (125) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The outline-style
CSS property is used to set the style of the outline of an element. An outline is a line that is drawn around elements, outside the border edge, to make the element stand out.
It is often more convenient to use the shortcut property
outline
instead of outline-style
, outline-width
and outline-color
.
In browsers prior to Gecko 1.8 (Firefox 1.5) this effect can be achieved using Mozilla CSS Extension
-moz-outline-style
.
Syntax
outline-style: auto | <border-style> | inherit
Values
<border-style>
can be any of the following:
- none
- No outline (
outline-width
is 0
). - dotted
- The outline is a series of dots.
- dashed
- The outline is a series of short line segments.
- solid
- The outline is a single line.
- double
- The outline is two single lines. The
outline-width
is the sum of the two lines and the space between them. - groove
- The outline looks as though it were carved into the canvas.
- ridge
- The opposite of
groove
: the outline looks as though it were coming out of the canvas. - inset
- The outline makes the box look as though it were embeded in the canvas.
- outset
- The opposite of
inset
: the outline makes the box look as though it were coming out of the canvas.
Examples
.example { /* make the outline a 3D groove style */
outline-style: groove; /* same result as "outline: groove" */
}
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.5 (1.8) | 8.0 | 7.0 | 1.2 (125) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
Specifications
See
outline
property
« CSS « CSS Reference
Summary
The outline-width
CSS property is used to set the width of the outline of an element. An outline is a line that is drawn around elements, outside the border edge, to make the element stand out:
In browsers previous to Gecko 1.8 (Firefox 1.5) essentially the same effect can be achieved using Mozilla CSS Extension
-moz-outline-width
.
Values
- thin
- Depends on the UA. Typically 1px in desktop browsers like Firefox.
- medium
- Depends on the UA. Typically 3px in desktop browsers like Firefox.
- thick
- Depends on the UA. Typically 5px in desktop browsers like Firefox.
- <length>
- See
<length>
values.
Examples
thin medium thick 2px 1ex 5em
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.5 (1.8) | 8.0 | 7.0 | 1.2 (125) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The overflow
CSS property specifies whether to clip content, render scroll bars or display overflow content of a block-level element.
Syntax
overflow: visible | hidden | scroll | auto |
inherit
Values
- visible
- Default value. Content is not clipped, it may be rendered outside the content box.
- hidden
- The content is clipped and no scrollbars are provided.
- scroll
- The content is clipped and desktop browsers use scrollbars, whether or not any content is clipped. This avoids any problem with scrollbars appearing and disappearing in a dynamic environment. Printers may print overflowing content.
- auto
- Depends on the user agent. Desktop browsers like Firefox provide scrollbars if content overflows.
Mozilla Extensions
- -moz-scrollbars-none
-
Obsolete Use
overflow:hidden
instead. - -moz-scrollbars-horizontal
-
Deprecated
Use of
overflow-x
and
overflow-y
is preferred. - -moz-scrollbars-vertical
-
Deprecated
Use of
overflow-x
and
overflow-y
is preferred. - -moz-hidden-unscrollable
- Is intended mainly for internal use and by themes. Disables scrolling of XML root elements and
<html>
, <body>
by arrow keys and mouse wheel.
Examples
p {
width: 12em;
border: dotted;
overflow: auto; /* append scrollbars if necessary */
}
overflow: hidden
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
overflow: scroll
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
overflow: auto
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
overflow: auto
short text
visible
(default)
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
Notes
Through Gecko 1.9.2 (Firefox 3.6), the overflow
property is incorrectly applied to table-group elements (<thead>
, <tbody>
, <tfoot>
). This behavior is corrected in later versions.
Browser compatibility
Browser | Lowest version |
Internet Explorer |
4.0 [*]
|
Firefox (Gecko) |
1.0 (1.0) |
Opera | 4.0-7.0
|
Safari (WebKit) |
1.0 (85) |
[*] IE 4-6 enlarges an element with overflow:visible
(default value) to fit the content in it. height/width
behaves like min-height/min-width
.
« CSS « CSS Reference
Summary
overflow-x
specifies whether to clip content, render a scroll bar or display overflow content of a block-level element, when it overflows at the left and right edges.
Syntax
overflow-x: visible | hidden | scroll | auto
Values
- visible
- Content is not clipped, it may be rendered outside the content box.
- hidden
- The content is clipped and no scrollbars are provided.
- scroll
- The content is clipped and desktop browsers use scrollbars, whether or not any content is clipped. This avoids any problem with scrollbars appearing and disappearing in a dynamic environment. Printers may print overflowing content.
- auto
- Depends on the user agent. Desktop browsers like Firefox provide scrollbars if content overflows.
Browser compatibility
Browser | Lowest Version |
Internet Explorer |
5.0 (*)
|
Firefox | 1.5 |
Opera | 9.5 |
Safari | 3.0 |
(*) IE8 introduced -ms-overflow-x
as a synonym for overflow-x
. Don't use the -ms-
prefix.
« CSS « CSS Reference
Summary
The padding-bottom
property of an element sets the padding space required on the bottom of an element. The padding area is the space between the content of the element and it's border. A negative value is not allowed.
-
Initial value
: 0
- Applies to: all elements except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column
-
Inherited
: no
- Percentages: refer to
width
of closest block-level ancestor - Media:
visual
-
Computed value
: the percentage as specified or the absolute length
Values
- <length>
- Specifies a positive fixed width. See
<length>
for details. - <percentage>
- A percentage with respect to the width of the containing block.
Examples
.content { padding-bottom: 5%; }
.sidebox { padding-bottom: 10px; }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 4.0 | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The padding
CSS property sets the required padding space on all sides of an element. The padding area is the space between the content of the element and its border. Negative values are not allowed.
The padding
property is a shortcut to avoid setting each side separately (padding-top, padding-right, padding-bottom, padding-left
).
-
Initial value
:
0
- Applies to: all elements (except
table-*-group
, table-row
and table-column
) -
Inherited
: no
- Percentages: relative to the width of the containing block
- Media:
visual
-
Computed value
: the percentage as specified or the absolute length
Values
Specifies one, two, three or four of the following values:
- <length>
- Specifies a positive fixed width. See
<length>
for details. - <percentage>
- With respect to the width of the containing block.
-
One single value applies to all 4 sides
-
Two values apply to 1. top and bottom and 2. to the left and right side
-
Three values apply to 1. top, 2. right and left and 3. to the bottom side
-
Four values apply to 1. top, 2. right, 3. bottom and 4. to the left side
Examples
padding: 5%; /* on all sides 5% padding */
padding: 10px; /* on all sides 10px padding */
padding: 10px 20px; /* top and bottom 10px padding */
/* left and right 20px padding */
padding: 10px 3% 20px; /* top 10px padding */
/* left and right 3% padding */
/* bottom 20px padding */
padding: 1em 3px 30px 5px; /* top 1em padding */
/* right 3px padding */
/* bottom 30px padding */
/* left 5px padding */
border:outset; padding:5% 1em;
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 4.0 | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The padding-left
property of an element sets the padding space required on the left side of an element. The padding area is the space between the content of the element and it's border. A negative value is not allowed.
-
Initial value
: 0
- Applies to: all elements except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column
-
Inherited
: no
- Percentages: refer to
width
of closest block-level ancestor - Media:
visual
-
Computed value
: the percentage as specified or the absolute length
Values
- <length>
- Specifies a positive fixed width. See
<length>
for details. - <percentage>
- A percentage with respect to the width of the containing block.
Examples
.content { padding-left: 5%; }
.sidebox { padding-left: 10px; }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 4.0 | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The padding-right
property of an element sets the padding space required on the right side of an element. The padding area is the space between the content of the element and its border. Negative values are not allowed.
-
Initial value
: 0
- Applies to: all elements except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column
-
Inherited
: no
- Percentages: refer to
width
of closest block-level ancestor - Media:
visual
-
Computed value
: the percentage as specified or the absolute length
Values
- <length>
- Specifies a positive fixed width. See
<length>
for details. - <percentage>
- A percentage with respect to the width of the containing block.
Examples
.content { padding-right: 5%; }
.sidebox { padding-right: 10px; }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 4.0 | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The padding-top
property of an element sets the padding space required on the top of an element. The padding area is the space between the content of the element and it's border. A negative values is not allowed.
-
Initial value
: 0
- Applies to: all elements except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column
-
Inherited
: no
- Percentages: refer to
width
of closest block-level ancestor - Media:
visual
-
Computed value
: the percentage as specified or the absolute length
Values
- <length>
- Specifies a positive fixed width. See
<length>
for details. - <percentage>
- A percentage with respect to the width of the containing block.
Examples
.content { padding-top: 5%; }
.sidebox { padding-top: 10px; }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 4.0 | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The page-break-after
CSS property adjusts page breaks after the current element.
Syntax
page-break-after: auto | always | avoid | left | right | inherit
Values
- auto
- Initial value. Automatic page breaks (neither forced nor forbidden).
- always
- Always force page breaks after the element.
- avoid
Unimplemented
- Avoid page breaks after the element.
- left
Unimplemented
- Force page breaks after the element so that the next page is formatted as a left page.
- right
Unimplemented
- Force page breaks after the element so that the next page is formatted as a right page.
Examples
/* display headlines on a new page */
h1,h2, h3 { page-break-after:always; }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) [*] | 4.0 | 7.0 | 1.2 (125) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
[*] Gecko only supports page-break-after:always
. See
bug 132035
« CSS « CSS Reference
Summary
The page-break-before
CSS property adjusts page breaks before the current element.
Syntax
page-break-before: auto | always | avoid | left | right | inherit
Values
- auto
- Initial value. Automatic page breaks (neither forced nor forbidden).
- always
- Always force page breaks before the element.
- avoid
Unimplemented
- Avoid page breaks before the element.
- left
Unimplemented
- Force page breaks before the element so that the next page is formatted as a left page.
- right
Unimplemented
- Force page breaks before the element so that the next page is formatted as a right page.
Examples
/* avoid page break before the div */
div.note { page-break-before: avoid; }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) [*] | 4.0 | 7.0 | 1.2 (125) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
[*] Gecko only supports page-break-before:always
. See
bug 132035
« CSS « CSS Reference
Summary
The page-break-inside
CSS property adjusts page breaks inside the current element.
Syntax
page-break-inside: auto | avoid | inherit
Values
- auto
- Initial value. Automatic page breaks (neither forced nor forbidden).
- avoid
- Avoid page breaks before the element.
Examples
/* avoid page break inside the paragraph */
p { page-break-inside: avoid; }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | -- | 8.0 | 7.0 | 1.3 (312) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
Summary
The <percentage>
CSS data types represent a percentage value. Many CSS properties can take percentage values, often to define sizes in terms of parent objects. Percentages are formed by a
<number>
immediately followed by the percentage sign %
. Like for all unit in CSS, there is no space between the '%' and the number.
Many length properties use percentages, such as
width
,
margin
and
padding
. Percentages can also be seen in
font-size
, where the size of the text is directly related to the size of its parent.
Note: only calculated values are inherited. So, even if a percentage value is used on the parent property, a real value, like a width in pixel for a
<length>
value, will be accessible on the inherited property, not the percentage value.
Interpolation
Values of the <percentage>
CSS data type can be interpolated in order to allow animations. In that case they are interpolated as real, floating-point, numbers. [1] The speed of the interpolation is determined by the timing function associated with the animation.
Examples
<div style="background-color:#0000FF;">
<div style="width:50%;margin-left:20%;background-color:#00FF00;">Width: 50%, Left margin: 20%</div>
<div style="width:30%;margin-left:60%;background-color:#FF0000;">Width: 30%, Left margin: 60%</div>
</div>
The above HTML will output:
Width: 50%, Left margin: 20%
Width: 30%, Left margin: 60%
<div style="font-size:18px;">
Full size text (18px)
<span style="font-size:50%;">50%</span>
<span style="font-size:200%;">200%</span>
</div>
The above HTML will output:
Full size text (18px) 50% 200%
Browser Compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
basic | 1.0 | 1.0 (1.0) | <=5.0 | yes | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | yes | yes | yes | yes | yes |
See also
-
CSS Reference index
- CSS Data Types :
<angle>
, <color>
, <frequency>
, <identifier>
, <integer>
, <length>
, <number>
, <percentage>
, <ratio>
, <resolution>
, <shape>
, <string>
, <time>
, <timing-function>
, <uri>
This is an experimental feature
Because this feature is still in development in some browsers, check the compatibility table for the proper prefixes to use in various browsers.
Summary
The perspective
CSS property determines the distance between the z=0 plane and the user in order to give to the 3D-positioned element some perspective. Each 3D element that is placed between the z=0 and the user is enlarged, each 3D-element with z<0 is shrinked. How much deformation is defined by the value of this property.
Part of the 3D-elements that are behind the user, i.e. that their z-axis coordinate is greater than the value of the perspective
CSS property are not drawn.
The vanishing point is by default placed at the center of the element, but its position can be changed using the
perspective-origin
property.
Using this property with a value different than 0
and none
creates a new stacking context.
Syntax
perspective: none or
perspective: depth
where :
none
- Is a keyword indicating that no perspective transform has to be applied.
- depth
- Is a
<length>
giving the distance from the user to the z=0 plane. It used to apply a perspective transform to the element and its content. If it 0
or a negative value, no perspective transform is applied.
Examples
perspective:150px; | perspective:300px; | perspective:600px; |
| | |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 12
-webkit
| 10.0 (10)
-moz
| 10
-ms
| -- |
(Supported)
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 3.0
-webkit
| 10.0 (10)
-moz
| ? | -- |
(Supported)
-webkit
|
This is an experimental feature
Because this feature is still in development in some browsers, check the compatibility table for the proper prefixes to use in various browsers.
Summary
The perspective-origin
CSS property determines the position the viewer is looking at. It is used as the vanishing point by the
perspective
property.
Syntax
perspective-origin: x-position or
perspective-origin: x-position y-position
When both x-position and y-position are keywords, the following is also valid:
perspective-origin: y-position x-position
where :
- x-position
- Indicates the position of the abscissa of the vanishing point. It can have one of the following values:
-
<percentage>
indicating the position relative to the width of the element. The value may be negative. -
<length>
indicating the position using a length value. The value may be negative. -
left
, a keyword being a shortcut for the 0
length value. -
center
, a keyword being a shortcut for the 50%
percentage value. -
right
, a keyword being a shortcut for the 100%
percentage value.
- y-position
- Indicates the position of the ordinate of the vanishing point. It can have one of the following values:
-
<percentage>
indicating the position relative to the height of the element. The value may be negative. -
<length>
indicating the position using a length value. The value may be negative. -
top
, a keyword being a shortcut for the 0
length value. -
center
, a keyword being a shortcut for the 50%
percentage value. -
bottom
, a keyword being a shortcut for the 100%
percentage value.
Examples
perspective-origin:top left; | perspective-origin:top; | perspective-origin:top right; |
| | |
perspective-origin:left; | perspective-origin:50% 50%; | perspective-origin:right; |
| | |
perspective-origin:bottom left; | perspective-origin:bottom; | perspective-origin:bottom right; |
| | |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 12
-webkit
| 10.0 (10)
-moz
| 10
-ms
| -- |
(Supported)
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 3.0
-webkit
| 10.0 (10)
-moz
| ? | -- |
(Supported)
-webkit
|
« CSS « CSS Reference
Summary
The CSS property pointer-events
allows authors to control whether or when an element may be the target of a mouse event. This property is used to specify under which circumstance (if any) a mouse event should go "through" an element and target whatever is "underneath" that element instead.
Syntax
pointer-events: auto | none | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | inherit
Values
auto
- The element behaves as it would if the
pointer-events
property was not specified. In SVG content this value and the value visiblePainted
have the same effect. none
- The element is never the target of mouse events, although mouse events may target its descendant elements if those descendants have
pointer-events
set to some other value, in which case mouse events will trigger event listeners on this element as appropriate on their way to/from the descendant during the event capture/bubble phases. visiblePainted
- SVG only. The element can only be the target of a mouse event when the
visibility
property is set to visible
and when the mouse cursor is over the interior (i.e., 'fill') of the element and the fill
property is set to a value other than none
, or when the mouse cursor is over the perimeter (i.e., 'stroke') of the element and the stroke
property is set to a value other than none
. visibleFill
- SVG only. The element can only be the target of a mouse event when the
visibility
property is set to visible
and when the mouse cursor is over the interior (i.e., fill) of the element. The value of the fill
property does not effect event processing. visibleStroke
- SVG only. The element can only be the target of a mouse event when the
visibility
property is set to visible
and when the mouse cursor is over the perimeter (i.e., stroke) of the element. The value of the stroke
property does not effect event processing. visible
- SVG only. The element can be the target of a mouse event when the
visibility
property is set to visible
and the mouse cursor is over either the interior (i.e., fill) or the perimeter (i.e., stroke) of the element. The values of the fill
and stroke
do not effect event processing. painted
- SVG only. The element can only be the target of a mouse event when the mouse cursor is over the interior (i.e., 'fill') of the element and the
fill
property is set to a value other than none
, or when the mouse cursor is over the perimeter (i.e., 'stroke') of the element and the stroke
property is set to a value other than none
. The value of the visibility
property does not effect event processing. fill
- SVG only. The element can only be the target of a mouse event when the pointer is over the interior (i.e., fill) of the element. The values of the
fill
and visibility
properties do not effect event processing. stroke
- SVG only. The element can only be the target of a mouse event when the pointer is over the perimeter (i.e., stroke) of the element. The values of the
stroke
and visibility
properties do not effect event processing. all
- SVG only. The element can only be the target of a mouse event when the pointer is over the interior (i.e., fill) or the perimeter (i.e., stroke) of the element. The values of the
fill
, stroke
and visibility
properties do not effect event processing.
Notes
Note that preventing an element from being the target of mouse events by using pointer-events
does not necessarily mean that mouse event listeners on that element cannot or will not be triggered. If one of the element's children has pointer-events
explicitly set to allow that child to be the target of mouse events, then any events targeting that child will pass through the parent as the event travels along the parent chain, and trigger event listeners on the parent as appropriate. Of course any mouse activity at a point on the screen that is covered by the parent but not by the child will not be caught by either the child or the parent (it will go "through" the parent and target whatever is underneath).
Mozilla and other W3C members would like to provide finer grained control (than just auto
and none
) in HTML for which parts of an element will cause it to "catch" mouse events, and when. To help us in deciding how pointer-events
should be further extended for HTML, if you have any particular things that you would like to be able to do with this property, then please add them to the Use Cases section of this wiki page (don't worry about keeping it tidy), or else send them to Jonathan Watt.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
SVG support | 1.0 | 1.5 (1.8)
| -- | 9.0 (2.0) | 3.0 (522) |
HTML/XML content | 2.0 | 3.6 (1.9.2)
| -- | -- | 4.0 (530) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The position
CSS property chooses alternative rules for positioning elements, designed to be useful for scripted animation effects.
A positioned element is an element whose computed position property is relative
, absolute
, or fixed
.
An absolutely positioned element is an element whose computed position property is absolute
or fixed
.
The
top
,
right
,
bottom
, and
left
properties specify the position of positioned elements.
Syntax
position: static | relative | absolute | fixed |
inherit
Values
- static
- Normal behavior. The
top
, right
, bottom
, and left
properties do not apply. - relative
- Lay out all elements as though the element were not positioned, and then adjust the element's position, without changing layout (and thus leaving a gap for the element where it would have been had it not been positioned). The effect of
position:relative
on table-*-group
, table-row
, table-column
, table-cell
, and table-caption
elements is undefined. - absolute
- Do not leave space for the element. Instead, position it at a specified position relative to its closest positioned ancestor or to the containing block. Absolutely positioned boxes can have margins, they do not collapse with any other margins.
- fixed
- Do not leave space for the element. Instead, position it at a specified position relative to the screen's viewport and doesn't move when scrolled. When printing, position it at that fixed position on every page.
Examples
Relative positioning
To position an element relatively 20px from the top and left of its normal position, the following CSS is used.
#two { position: relative; top: 20px; left: 20px; }
Note how the other elements are displayed as if "Two" were in it's normal position and taking up space.

Absolute positioning
Elements that are positioned relatively are still considered to be in the normal flow of elements in the document. In contrast, an element that is positioned absolutely is taken out of the flow and thus takes up no space when placing other elements. The absolutely positioned element is positioned relative to nearest positioned ancestor. If a positioned ancestor doesn't exist, the initial container is used.
In the example below, the blue ancestor div is positioned relative (so it becomes the nearest positioned ancestor) and box Two is positioned absolutely:
#ancestor { position: relative; background: #ddf; width: 500px; }
#two { position: absolute; top: 20px; left: 20px; }

If #ancestor had not been positioned relative, box Two would have appeared relative to the upper left corner of the page.
Fixed positioning
Fixed positioning is similar to absolute positioning, with the exception that the element's containing block is the viewport. This is often used to create a floating element that stays in the same position even after scrolling the page. In the example below the "One" box is fixed 80px from the top of the page and 20px from the left:
#one { position: fixed; top: 80px; left: 20px }
When viewing the top of the page, the position box appears in the upper left, and after scrolling, it remains in the same place relative to the viewport:


Notes
For relatively positioned elements, the
top
or
bottom
property specifies the vertical offset from the normal position and the
left
or
right
property specifies the horizontal offset.
For absolutely positioned elements, the
top
,
right
,
bottom
, and
left
properties specify offsets from the edge of the element's containing block (what the element is positioned relative to). The margin of the element is then positioned inside these offsets.
Most of the time, absolutely positioned elements have auto
values of
height
and
width
computed to fit the contents of the element. However, non-replaced absolutely positioned elements can be made to fill the available space by specifying (as other than auto
) both
top
and
bottom
and leaving
height
unspecified (that is, auto
). Likewise for
left
,
right
, and
width
.
Except for the case just described of absolutely positioned elements filling the available space:
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 4.0 | 4.0 | 1.0 (85) |
fixed value | 1.0 | 1.0 (1.0) | 7.0 | 4.0 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The quotes
property indicates how user agents should render quotation marks.
Syntax
quotes: [<string> <string>]+ | none | inherit
Values
- none
- The
open-quote
and close-quote
values of the content property produce no quotation marks. - [<string> <string>]+
- One or more pairs of
<string>
values for open-quote
and close-quote
. The first pair represents the outer level of quotation, the second pair is for the first nested level, next pair for third level and so on.
Examples
q { quotes: '"' '"' "'" "'" }
q:before { content: open-quote }
q:after { content: close-quote }
Notes
Starting in Firefox 3.5, the initial value of the quotes property can be read using
-moz-initial
This wasn't possible in earlier versions of Firefox.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 11 | 1.5 | 8.0 | 4.0 | ? |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
Summary
The <ratio>
CSS data type, used for describing aspect ratios in media queries, denotes the proportion between two unitless values. It is a strictly positive
<integer>
followed by a slash ('/', Unicode U+002F SOLIDUS
) and a second strictly positive
<integer>
. There may be spaces before and after the solidus.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | <4 | 3.5 (1.9.1) | 9 [1]
| 9.5 | 1.0 (?) [2]
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | yes | yes | ? | yes | yes |
See also
- CSS Media Queries
-
CSS Reference Index
- CSS Data Types :
<angle>
, <color>
, <frequency>
, <identifier>
, <integer>
, <length>
, <number>
, <percentage>
, <ratio>
, <resolution>
, <shape>
, <string>
, <time>
, <timing-function>
, <uri>
« CSS « CSS Reference
Summary
The resize
CSS property lets you control the resizability of an element.
Syntax
resize: none | both | horizontal | vertical | inherit
Values
- none
- The element offers no user-controllable method for resizing the element.
- both
- The element displays a mechanism for allowing the user to resize the element, which may be resized both horizontally and vertically.
- horizontal
- The element displays a mechanism for allowing the user to resize the element, which may only be resized horizontally.
- vertical
- The element displays a mechanism for allowing the user to resize the element, which may only be resized vertically.
Note: resize
does not apply to blocks for which the
overflow
property is set to
visible
.
Examples
Disabling resizability of textareas
By default,
<textarea>
elements are resizable in Gecko 2.0 (Firefox 4). You may override this behavior with the CSS shown below:
textarea.example {
resize: none; /* disables resizability */
}
Using resize with arbitrary elements
You can use the resize property to make any element resizable. In the example below, a resizable
<div>
box contains a resizable paragraph (
<p>
element:
<div style="resize:both; overflow:scroll; width:300px; height:300px; border:1px solid black">
<p style="resize:both; overflow:scroll; width:200px; height:200px; border:1px solid black">
This paragraph is resizable, because the CSS resize property is set to 'both' on this
element.
</p>
</div>

View the live example
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 4.0 (2.0) | -- | -- | 3.0 (522) |
Applies to | <textarea> | block-level and replaced elements, table cells, and inline blocks (unless
overflow is visible ) | | | <textarea> |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
Summary
The <resolution>
CSS data types, used in media queries, denotes the density of pixels of an output device, its resolution. It is a <number>
immediately followed by a unit of resolution (dpi
, dpcm
, ...). Like for any CSS dimension, there is no space between the unit literal and the number.
Units
dpi
- This unit represents the number of dots per inch. A screen typically contains 72 or 96 dpi; a printed document usually reach much greater dpi. As 1 inch is 2.54 cm,
1dpi ≈ 2.54dpcm
. dpcm
- This unit represents the number of dots per centimeter. As 1 inch is 2.54 cm,
1dpcm ≈ 0.39dpi
.
Examples
Here are some correct uses of <resolution>
values:
96dpi Correct use: a <number> (here an <integer>) followed by the unit.
@media print and (min-resolution: 300dpi) { ... } Correct use in the context of a media query.
Here are some incorrect uses:
72 dpi Incorrect: no spaces allowed between the <number> and the unit.
ten dpi Incorrect: only digits must be used
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | <4 | 3.5 (1.9.1) [*] | 9 [1]
| 9.5 | 1.0 (?) [2]
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | yes | yes | ? | yes | yes |
[*] Before Firefox 8 (Gecko 8.0), it erroneously accepted only CSS Dimension with
<integer>
followed by the unit. From that version, it supports any valid CSS dimensions (
<number>
immediately followed by the unit).
See also
- CSS Media Queries
-
CSS Reference Index
- CSS Data Types :
<angle>
, <color>
, <frequency>
, <identifier>
, <integer>
, <length>
, <number>
, <percentage>
, <ratio>
, <resolution>
, <shape>
, <string>
, <time>
, <timing-function>
, <uri>
« CSS « CSS Reference
Summary
The right
property specifies part of the position of positioned elements.
For absolutely positioned elements (those with
position
: absolute
or position: fixed
), it specifies the distance between the right margin edge of the element and the right edge of its containing block.
Syntax
right: <length> | <percentage> | auto | inherit ;
Values
-
<length>
- A length, can be negative, zero, or positive.
-
<percentage>
- A percentage of the containing block's width.
Examples
View the live example
#example_3 {
width: 600px;
height: 400px;
background-color: #FFC7E4;
position: relative;
top: 20px;
left: 20px;
}
#example_4 {
width:200px;
height:200px;
background-color: #FFD7C2;
position:absolute;
bottom:10px;
right: 20px;
}
Notes
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | 1.0 | 1.0 (1.7 or earlier)
| 5.5 | 5 | 1.0 |
Feature | Firefox Mobile (Gecko) | Android | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
Summary
The <shape>
CSS data type denotes the specific form of a region. This region is used to define on which part of an element some properties like
clip
do apply.
In the current specification, a <shape>
, though designed to denote any kind of form, can only represents a rectangular region, defined using the rect()
functional notation.
The rect() function
The rect() functional notation produces a region in the form of a rectangle.
Syntax
rect(top, right, bottom, left)
where:
- top
- Is a
<length>
representing the offset for the top of the rectangle relative to the top border of the element's box.
- right
- Is a
<length>
representing the offset for the right of the rectangle relative to the left border of the element's box.
- bottom
- Is a
<length>
representing the offset for the bottom of the rectangle relative to the top border of the element's box.
- left
- Is a
<length>
representing the offset for the left of the rectangle relative to the left border of the element's box.
Interpolation
Values of the <shape>
CSS data type which are rectangles can be interpolated in order to allow animations. In that case they are interpolated over their top
, right
, bottom
and left
component, each treated as a real, floating-point, number. [1] The speed of the interpolation is determined by the timing function associated with the animation.
Examples
img.clip04 {
clip: rect(10px, 20px, 20px, 10px);
}
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | 1.0 | 1.0 (1.7 or earlier)
| 5.5[*] | 9.5 | 1.3 |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
[*] From IE 5.5 to IE 7 included, the IE supported syntax of the rect() didn't allow the comma as the parameter separator, but a space. From IE 8, the standard syntax (only commas) is supported.
See also
- Related CSS properties:
clip
- The -moz-image-rect() function with similar coordinate than
rect()
. -
CSS Reference index
- CSS Data Types :
<angle>
, <color>
, <frequency>
, <identifier>
, <integer>
, <length>
, <number>
, <percentage>
, <ratio>
, <resolution>
, <shape>
, <string>
, <time>
, <timing-function>
, <uri>
The <string>
CSS data type represents a string. It is formed by a Unicode characters delimited by either double (") or single (') quotes. A double quoted string cannot contain double quotes unless escaped using a backslash (\). The same practice applies for single quoted strings, they cannot contain single quotes unless escaped using a backslash (\). The backslash character must be escaped to be part of the string.
New lines are not accepted unless escaped by using a line feed character such as \A or \00000a. However, strings can span over several lines. In that case, the new line must be escaped using a \ as the last character of the line.
Characters can be described using their Unicode code point in hexadecimal, when escaped using \. \27 represents the single quote (').
Examples
/* Simple quote escaping */
"Awesome string with double quotes"
"Awesome string with \" escaped double quotes"
'Awesome string with single quotes'
"Awesome string with \' escaped single quotes"
/* New line in a string */
"Awesome string with \Aline break"
/* String spanning over two lines (these two strings are exactly the same) */
"A really long \
awesome string"
"A really long awesome string"
Note: Double quoted strings can also be escaped using \22 and single quoted strings can be escaped using \27.
Browser Compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
basic | 1.0 | 1.0 (1.0) | <=5.0 | yes | 1.0 (85) |
\xx | 1.0 | 1.0 (1.0) | 6.0 [1]
| yes | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | yes | yes | yes | yes | yes |
\xx | yes | yes | yes | yes | yes |
See also
-
CSS Reference index
- CSS Data Types :
<angle>
, <color>
, <frequency>
, <identifier>
, <integer>
, <length>
, <number>
, <percentage>
, <ratio>
, <resolution>
, <shape>
, <string>
, <time>
, <timing-function>
, <uri>
« CSS « CSS Reference
Summary
table-layout
property defines the algorithm to be used to layout the table cells, rows, and columns.
Syntax
table-layout: inherit | auto | fixed
Values
-
inherit
-
auto
- An automatic table layout algorithm is commonly used by most browsers for table layout. The width of the table and its cells depends on the content thereof.
- fixed
- Table and column widths are set by the widths of
table
and col
elements or by the width of the first row of cells. Cells in subsequent rows do not affect column widths.
Under the "fixed" layout method, the entire table can be rendered once the first table row has been downloaded and analyzed. This can speed up rendering time over the "automatic" layout method, but subsequent cell content may not fit in the column widths provided. Any cell that has content that overflows uses the
overflow
property to determine whether to clip the overflow content.
Browser compatibility
Browser | Lowest Version |
Internet Explorer | 5.0 |
Firefox | 1.0 |
Opera | 7.0 |
Safari | 1.0 |
Summary
The tab-size
CSS property is used to customize the width of a tab (U+0009
) character.
Syntax
tab-size: <integer> | inherit
Values
-
<integer>
- The number of spaces in a tab. Must be positive.
- inherit
- Inherits from the parent element.
Examples
pre {
tab-size: 99; /* Don't use tabs! */
}
Browser compatibility
Browser | Lowest Version | Support of |
Internet Explorer | --- | --- |
Firefox | 4.0 (Gecko 2.0) | -moz-tab-size |
Opera | 10.60 | -o-tab-size |
Safari (WebKit) | --- | --- |
« CSS « CSS Reference
Summary
The text-align
CSS property describes how inline content like text is aligned in its parent block element. text-align
does not control the alignment of block elements itself, only their inline content.
-
Initial value
: a nameless value that acts as
left
if 'direction' is 'ltr', right
if 'direction' is 'rtl' - Applies to: block level elements, table cells and inline-blocks
-
Inherited
: yes
- Media:
visual
-
Computed value
: as specified
Syntax
text-align: left | center | right | justify | start | end | -moz-left | -moz-center | -moz-right |
inherit
Values
- left
- The inline contents are aligned to the left edge of the line box.
- right
- The inline contents are aligned to the right edge of the line box.
- center
- The inline contents are centered within the line box.
- justify
- The text is justified. Text should line up their left and right edges to the left and right content edges of the paragraph.
- start
- The same as
left
if direction is left-to-right and right
if direction is right-to-left. - end
Requires Gecko 1.9.2
- The same as
right
if direction is left-to-right and left
if direction is right-to-left.
Mozilla Extensions
- -moz-center
- Centers inline and also block content.
- -moz-left
- Aligns inline and also block content.
- -moz-right
- Aligns inline and also block content.
Examples
View Live Examples
Live Examples
div {
text-align: center; border:solid; }
p { background:gold; width:22em; }
some more inline content...
div {
text-align: center; border:solid; }
p { background:gold; width:22em; margin: 1em auto; }
some more inline content...
div {
text-align:-moz-center; text-align:-webkit-center; border:solid; }
p { background:gold; width:22em; }
some more inline content...
Notes
The standard-compatible way to center a block itself without centering its inline content is setting the left and right margin
to auto, e.g.:
margin:auto;
or margin:0 auto;
or margin-left:auto; margin-right:auto;
Browser compatibility
Browser | Basic support | Block alignment values |
start value |
end value |
Internet Explorer | 3.0 | --- | --- | --- |
Firefox (Gecko) | 1.0 (1.0) | 1.0 (1.0) | -moz-left | -moz-center | -moz-right | 1.0 (1.0) | 3.6 (1.9.2) |
Opera | 3.5 | --- | --- | --- |
Safari (WebKit) | 1.0 (85) | 1.0 (85) | -khtml-left | -khtml-center | -khtml-right | 3.1 (525) | 3.1 (525) |
1.3 (312) | -khtml-left | -khtml-center | -khtml-right | -webkit-left | -webkit-center | -webkit-right |
« CSS « CSS Reference
Summary
The text-decoration-color
CSS property sets the color used when drawing underlines, overlines, or strike-throughs specified by
text-decoration-line
. This is the preferred way to color these text decorations, rather than using combinations of other HTML elements.
Values
<color>
- The
color
property accepts various keywords and numeric notations. See
<color>
values for more details.
Examples
.example {
text-decoration: underline;
text-decoration-color: red;
}
The example above has the same effect as the following code, which also adds a hover style.
<!DOCTYPE html>
<html>
<head>
<style>
.example {
font-size: 24px;
text-decoration: underline;
color: red;
}
.example:hover {
color: blue;
text-decoration: line-through;
}
</style>
</head>
<body>
<span class="example">
<span style="color:black">black text with red underline and blue hover</span>
</span>
</body>
</html>
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | ? | 6.0 (6.0)
(prefixed with -moz- ) | ? | ? | ? |
Feature | Android | Firefox mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | 6.0 (6.0)
(prefixed with -moz- ) | ? | ? | ? |
« CSS « CSS Reference
Summary
The text-decoration
CSS property is used to set the text formattings underline, overline, line-through
and blink
.
Syntax
text-decoration: none | [underline || overline || line-through || blink] | inherit
Values
Accepts one or more whitespace separated values:
- none
- Produces no text decoration.
- underline
- Each line of text is underlined.
- overline
- Each line of text has a line above it.
- line-through
- Each line of text has a line through the middle.
- blink
- Text blinks. Browsers may ignore this value, as Internet Explorer and Safari does. Supported by Firefox (Gecko) and Opera. Note that not blinking the text is one technique to satisfy checkpoint 3.3 of WAI-UAAG.
- -moz-anchor-decoration
-
Mozilla CSS Extension, not suitable for web content.
Examples
View Live Examples
p { text-decoration: line-through; }
p { text-decoration: underline overline; } /* multiple values are allowed */
Notes
Text decorations draw across descendant elements. This means that it is not possible to disable on a descendant a text decoration that is specified on one of its ancestors.
For example, in the markup:
<p>This text has <em>some emphasized words</em> in it.</p>
the style rule:
p { text-decoration: underline }
would cause the entire paragraph to be underlined. However, the style rule:
em { text-decoration: none }
would not cause any change; the entire paragraph would still be underlined.
(However, the rule em { text-decoration: overline }
would cause a second decoration to appear on "some emphasized words".)
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 1.0 (1.7 or earlier)
| 1.0 | 3.0 | 3.5 | 1.0 |
blink value | 1.0 (1.7 or earlier)
| -- | -- | 4.0 | -- |
Feature | Firefox Mobile (Gecko) | Android | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
blink value | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The text-decoration-line
CSS property sets what kind of line decorations are added to an element.
Syntax
text-decoration-line: none | underline || overline || line-through
Values
Accepts one or more whitespace separated values:
- none
- Produces no text decoration.
- underline
- Each line of text is underlined.
- overline
- Each line of text has a line above it.
- line-through
- Each line of text has a line through the middle.
- -moz-anchor-decoration
-
Mozilla CSS Extension, not suitable for web content.
Examples
.example {
text-decoration-line: underline;
text-decoration-style: wavy;
text-decoration-color: red;
}
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 6.0 (6.0)
(prefixed with -moz- ) | ? | ? | ? | ? |
Feature | Firefox Mobile (Gecko) | Android | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
This is an experimental feature
Because this feature is still in development in some browsers, check the compatibility table for the proper prefixes to use in various browsers.
Summary
The text-decoration-style
CSS property defines the style of the lines specified by
text-decoration-line
. The style applies to all lines, there is no way to define different style for each of the line defined by text-decoration-line
.
If the specified decoration has a specific semantic meaning, like a line-through line meaning that some text has been deleted, authors are encouraged to denote this meaning using an HTML tag, like
<del>
or
<s>
. As browsers can disabled styling in some cases, the semantic meaning won't disappear in such a situation.
Syntax
text-decoration-style: inherit or
text-decoration-style: style
where :
- inherit
- Is a keyword indicating to reuse the value calculated on the parent element.
- style
- Is one of the following keywords :
Keyword | Description | Live example | Comment |
solid | Draws a single line |
Lorem ipsum
| |
double | Draws a double line |
Lorem ipsum
| |
dotted | Draws a dotted line |
Lorem ipsum
| |
dashed | Draws a dashed line |
Lorem ipsum
| |
wavy | Draws a wavy line |
Lorem ipsum
| |
-moz-none Non-standard
| Do not draw a line |
Lorem ipsum
|
Do not use : use
text-decoration-line : none instead |
Examples
.example {
text-decoration-line: underline;
text-decoration-style: wavy;
text-decoration-color: red;
}
This is how it looks.
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 6.0 (6.0)
-moz
| -- | -- | -- | -- |
Feature | Firefox Mobile (Gecko) | Android | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 6.0 (6.0)
-moz | -- | -- | -- | -- |
« CSS « CSS Reference
Summary
The text-indent
CSS property specifies how much horizontal space should be left before beginning of the first line of the text content of an element. Horizontal spacing is with respect to the left (or right, for right-to-left layout) edge of the containing block element's box.
-
Initial value
:
0
- Applies to: block and inline-block elements, table cells
-
Inherited
: yes
- Percentages: refer to width of containing block
- Media:
visual
-
Computed value
: the percentage as specified or the absolute length
Syntax
text-indent: <length> | <percentage>
Values
- <length>
- Indentation is specified as fixed
<length>
. Negative Values are allowed. See
<length>
values for possible units. - <percentage>
- Indentation is a
<percentage>
of the containing block width.
Examples
p { text-indent: 2em }
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
Browser compatibility
Browser | Lowest version |
Internet Explorer | 3.0 |
Firefox (Gecko) | 1.0 (1.0) |
Opera | 3.5 |
Safari (WebKit) | 1.0 (85) |
Summary
The text-overflow
CSS property determines how overflowed content that is not displayed is signaled to the users. It can be clipped, display an ellipsis ('…
', U+2026 Horizontal Ellipsis
) or a Web author-defined string.

This CSS property doesn't force an overflow to occur, to do so and make text-overflow
to be applied, the author must apply some additional properties on the element, like setting
overflow
to hidden
.
Syntax
text-overflow: inherit or
text-overflow: end-overflow-type or
text-overflow:
left-overflow-type
right-overflow-type
where :
inherit
- Is a keyword indicating to use the value of this CSS property that the parent element of the element uses.
- end-overflow-type
- Is an
<overflow-type>
CSS value describing the overflow to perform at the end of the line. The end of the line is its right end if the text is written with left-to-right directionality, it is its left end if the text is written with right-to-left directionality. - left-overflow-type
- Is an
<overflow-type>
CSS value describing the overflow to perform at the left end of the line. The directionality of the text has no influence on which end of the line is affected. - right-overflow-type
- Is an
<overflow-type>
CSS value describing the overflow to perform at the right end of the line. The directionality of the text has no influence on which end of the line is affected.
<overflow-type>
The <overflow-type>
CSS type describes how text overflow, when not visible, must be handled. The following values are valid:
clip
- This keyword value indicates to truncate the text at the limit of the content area. This is the default value.
ellipsis
- This keyword value indicates to display ellipses ('
…
', U+2026 Horizontal Ellipsis
) to represent clipped text. The ellipsis is displayed inside the content area, shortening more the size of the displayed text. If there is not enough place to display ellipsis, they are clipped. - string
- The
<string>
to be used to represent clipped text. The string is displayed inside the content area, shortening more the size of the displayed text. If there is not enough place to display string, they are clipped.
Examples
p {
white-space: nowrap;
width: 100%;
overflow: hidden; /* "overflow" value must be different from "visible" */
text-overflow: ellipsis;
}
CSS value | direction: ltr | direction: rtl |
Expected Result | Live result | Expected Result | Live result |
visible overflow | 1234567890 | 1234567890 | 0987654321 | 1234567890 |
text-overflow: clip | 123456 | 1234567890 | 654321 | 1234567890 |
text-overflow: ellipsis | 1234… | 1234567890 | …4321 | 1234567890 |
text-overflow: '.' | 12345. | 1234567890 | .54321 | 1234567890 |
text-overflow: clip clip | 123456 | 1234567890 | 654321 | 1234567890 |
text-overflow: clip ellipsis | 12345… | 1234567890 | 6543… | 1234567890 |
text-overflow: clip '.' | 12345. | 1234567890 | 6543. | 1234567890 |
text-overflow: ellipsis clip | …3456 | 1234567890 | …54321 | 1234567890 |
text-overflow: ellipsis ellipsis | …345… | 1234567890 | …543… | 1234567890 |
text-overflow: ellipsis '.' | …345. | 1234567890 | …543. | 1234567890 |
text-overflow: ',' clip | ,3456 | 1234567890 | ,54321 | 1234567890 |
text-overflow: ',' ellipsis | ,345… | 1234567890 | ,543… | 1234567890 |
text-overflow: ',' '.' | ,345. | 1234567890 | ,543. | 1234567890 |
Specifications
A previous version of this interface reached the Candidate Recommendation status. As some not-listed-at-risk features needed to be removed, the spec was demoted to the Working Draft level, explaining why browsers implemented this property unprefixed, though not at the CR state.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 (312.3) | 7.0 (7.0)
| 6.0 [*] | 11 [**] | 1.3 (312.3) |
Two-value syntax | -- | 9.0 (9.0)
| -- | -- | -- |
String value | -- | 9.0 (9.0)
| -- | -- | -- |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | (Supported) | 7.0 (7.0)
| ? | (Supported) | (Supported) |
Two-value syntax | -- | 9.0 (9.0)
| -- | -- | -- |
String value | -- | 9.0 (9.0)
| -- | -- | -- |
[*] IE8 introduced
the prefixed version, -ms-text-overflow
, synonymous with text-overflow
.
[**] Opera supported the prefixed version, -o-text-overflow
, from version 9.0 on.
Summary
Provides information to the rendering engine about what to optimize for when rendering text. The browser makes trade-offs among speed, legibility, and geometric precision. The text-rendering property is an SVG property that is not defined in any CSS standard. However, Gecko and WebKit browsers let you apply this property to HTML and XML content on Windows and Linux.
Note: This property has no effect on Mac OS X.
One very visible effect is: optimizeLegibility
enables ligatures (ff, fi, fl etc.) in text smaller than 20px for some fonts (for example, Microsoft's Calibri, Candara, Constantia and Corbel or the DejaVu font family).
Syntax
text-rendering: auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit
Values
auto
- The browser makes educated guesses about when to optimize for speed, legibility, and geometric precision while drawing text. For differences in how this value is interpreted by the browser, see the compatibility table.
optimizeSpeed
- The browser emphasizes rendering speed over legibility and geometric precision when drawing text. It disables kerning and ligatures.
optimizeLegibility
- The browser emphasizes legibility over rendering speed and geometric precision. This enables kerning and optional ligatures.
geometricPrecision
-
The browser emphasizes geometric precision over rendering speed and legibility. Certain aspects of fonts—such as kerning—don't scale linearly, so geometricPrecision can make text using those fonts look good.
In SVG, when text is scaled up or down, browsers calculate the final size of the text (which is the specified font size and the applied scale) and request a font of that computed size from the platform's font system. But if you request a font size of, say, 9 with a scale of 140%, the resulting font size of 12.6 doesn't explicitly exist in the font system, so the browser rounds the font size to 12 instead. This results in stair-step scaling of text.
But the geometricPrecision
property—when fully supported by the rendering engine—lets you scale your text fluidly. For large scale factors, you might see less-than-beautiful text rendering, but the size is what you would expect—neither rounded up nor down to the nearest font size supported by Windows or Linux.
WebKit precisely applies the specified value, but Gecko treats the value the same as optimizeLegibility
.
Examples
/* make sure all fonts in the HTML document display in all its glory,
but avoid inadequate ligatures in class foo elements */
body { text-rendering: optimizeLegibility; }
.foo { text-rendering: optimizeSpeed; }
Live Example
CSS code | Kerning | Ligatures |
font: 19.9px 'DejaVu Serif',Constantia; | LYoWAT | ff fi fl ffl |
font: 20px 'DejaVu Serif',Constantia; | LYoWAT | ff fi fl ffl |
font: 3em 'DejaVu Serif',Constantia; text-rendering: optimizeSpeed; | LYoWAT | ff fi fl ffl |
font: 3em 'Dejavu Serif',Constantia; text-rendering: optimizeLegibility; | LYoWAT | ff fi fl ffl |
Gecko Notes
The 20px threshold value of the auto
keyword can be changed by changing the browser.display.auto_quality_min_font_size
preference.
The optimizeSpeed
option has no effect on Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
, because the standard code for text rendering is already very fast and there is not a faster code path at this time. See
bug 595688
for details.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support for Windows and Linux | 4.0 |
3.0 (1.9) | -- | -- | 5.0 (532.5) |
Basic support for other operating systems | -- | -- | -- | -- | -- |
auto | Chrome treats this as optimizeSpeed . Work is continuing on
WebKit bug 41363 | If the font size is 20 px or higher, Gecko browsers use optimizeLegibility ; for smaller text, they use optimizeSpeed . | -- | -- | Safari treats this as optimizeSpeed . Work is continuing on
WebKit bug 41363 |
geometricPrecision | 13 supports true geometric precision, without rounding up or down to the nearest supported font size in the operating system. Introduced in WebKit 535.1
WebKit bug 60317 | Gecko treats the value the same as optimizeLegibility . | --
| --
| |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
Specifications
This is an SVG property, it is not defined in any CSS standard. Gecko (Firefox) and WebKit apply text-rendering
also to HTML and XML content.
« CSS « CSS Reference
Introduced in Gecko 1.9.1
(Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)
Summary
The text-shadow
CSS property accepts a comma-separated list of shadow effects to be applied to the text and
text-decorations
of the element.
Multiple shadow effects are applied front-to-back: the first shadow is on top.
Syntax
text-shadow: none | [<shadow>,]* <shadow>
where <shadow> is:
[ <color>? <offset-x> <offset-y> <blur-radius>? | <offset-x> <offset-y> <blur-radius>? <color>? ]
Values
- <color>
- Optional, allowed before or after the
<length>
values. If the
<color>
is not specified, a UA-chosen color will be used. Gecko/Firefox uses the value of the element's
color
property. Other browsers may differ.
Note: Specify a color for browser interoperability.
- <offset-x> <offset-y>
- Required. These
<length>
values set the shadow offset. <offset-x>
specifies the horizontal distance. Negative values place the shadow to the left of the text. <offset-y>
specifies the vertical distance. Negative values place the shadow above the text. If both values are 0
, the shadow is placed behind the text (and may generate a blur effect when <blur-radius>
is set).
See
<length>
for possible units. - <blur-radius>
- Optional. This is a
<length>
value. If not specified, it will be 0
. The higher this value, the bigger the blur, so the shadow becomes wider and lighter.
Gecko 2 note
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Starting in Gecko 2, the blur radius is capped at 300 for performance reasons. Also, let's face it, blur radii that big are just crazy.
Examples
text-shadow: orange 0 -2px;
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
text-shadow: 1px 1px 2px black, 0 0 1em blue, 0 0 0.2em blue;
color: white;
font: 1.5em Georgia, "Bitstream Charter", "URW Bookman L", "Century Schoolbook L", serif;
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
text-shadow: rgba(0,0,0,0.1) -1px 0, rgba(0,0,0,0.1) 0 -1px,
rgba(255,255,255,0.1) 1px 0, rgba(255,255,255,0.1) 0 1px,
rgba(0,0,0,0.1) -1px -1px, rgba(255,255,255,0.1) 1px 1px;
color: gold;
background: gold;
Browser compatibility
Browser | Lowest version |
Internet Explorer | 10 [1]
|
5.5 supports Microsoft's Shadow and DropShadow Filter
|
Firefox (Gecko) |
3.5 (1.9.1) |
Opera | 9.5 |
Safari (WebKit) | 1.1 (100), multiple text-shadows since 4.0 (528) |
Konqueror | 3.4 |
Chromium | 2.0.158.0 |
-
Gecko (Firefox) theoretically supports infinite text-shadows (don't try it).
-
Opera supports a maximum of 6-9 text-shadows for performance reasons. The blur radius is limited to 100px.
Opera 9.5-10.1 adheres to the old, reverse painting order (CSS2, the first specified shadow is on the bottom). -
Safari: Any shadows that do not explicitly specify a color are transparent.
Safari 1.1-3.2 only supports one text-shadow (displays the first shadow of a comma-separated list and ignores the rest).
Specifications
text-shadow
was improperly defined in CSS2 and dropped in CSS2.1. The CSS3 Text spec improved the syntax.
« CSS « CSS Reference
Summary
The text-transform
CSS property specifies capitalization and lowercase effects of an element's text should be rendered.
Syntax
text-transform: capitalize | uppercase | lowercase | none |
inherit
Values
- capitalize
- First letter on each word is uppercase and other letter unaffected.
- uppercase
- All letters are converted to uppercase.
- lowercase
- All letters are converted to lowercase.
- none
- No case change effects.
Examples
p:first-line { text-transform: uppercase; }
Live Examples
-
none
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. -
capitalize
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. -
uppercase
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. -
lowercase
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Browser compatibility
Browser | Lowest version |
Internet Explorer | 4.0 |
Firefox (Gecko) | 1.0 (1.0) |
Opera | 3.5 |
Safari (WebKit) | 1.0 (85) |
Summary
The <time>
CSS data type denotes time dimensions expressed in seconds or milliseconds. They consists of a
<number>
immediately followed by the unit. Like for any CSS dimension, there is no space between the unit literal and the number.
The following units may be used :
-
s
which represents a time in seconds. E.g. 0s
, 1.5s
, -60s
. -
ms
which represents a time in milliseconds. E.g. 0ms
, 1500ms
, -60000ms
.
Conversion between s
and ms
follows the logical 1s
= 1000ms
.
As all units represents the same time for the value 0, the unit may be omitted in that case: 0
represents 0s
, 0ms
.
Examples
These are valid time values:
12s Positive integer
-456ms Negative integer
4.3ms Non-integer
14mS The unit is case-insensitive, though capital letters are not recommended for s and ms.
0 Zero (without the unit)
+0s Zero, with a leading + and the unit
-0ms Zero, with a leading - and the unt(Though strange, this is an allowed value)
These are invalid time values:
12.0 This is a <number>, not an <time>, it must have a unit
7 ms No space is allowed between the <number> and the unit
Browser compatibility
Feature | Chrome (Webkit) | Firefox (Gecko) | Internet Explorer | Opera (Presto) | Safari (Webkit) |
Basic support | <=11 (?) | 4.0 (2.0) | 9.0 [1]
| 10.5 (2.3) [2]
| <=3.2 (?) |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | no | ? |
See also
-
CSS Reference index
- CSS Data Types :
<angle>
, <color>
, <frequency>
, <identifier>
, <integer>
, <length>
, <number>
, <percentage>
, <ratio>
, <resolution>
, <shape>
, <string>
, <time>
, <timing-function>
, <uri>
Summary
The <timing-function>
CSS data type denotes a mathematical function that describes how fast one-dimensional values change during transitions or animations. This in essence lets you establish an acceleration curve, so that the speed of the animation can vary over its duration.
It is a function linking the time with a ratio of the output value (expressed as a
<number>
, with 0.0
representing the initial state, 1.0
the final state.

The output ratio can be greater than 1.0 (or smaller than 0.0). This causes the animation to go farther than the final state, then come back, in a kind of bouncing effect.
Nevertheless, if the output value goes outside of its possible range, such as a component of a color going greater than 255
or smaller than 0
, the value is clipped to its closest allowed value (in the case of a color-component 255
and 0
respectively. Some cubic-bezier()
curves exhibit this property.
Values
CSS supports two kinds of timing functions: the subset of the cubic Bézier curves that are functions and staircase functions. The most useful of these functions are given a keyword that allows to easily describe them.
The cubic-bezier()
class of timing-functions
 | The cubic-bezier() functional notation defines a cubic Bézier curve. As these curves are continuous, they are often used to smooth down the start and end of the animation and are therefore sometimes called easing functions. A cubic Bézier curve is defined by four points P0, P1, P2, and P3. P0 and P3 are the start and the end of the curve and, in CSS these points are fixed as the coordinates are ratios (the abscissa the ratio of time, the ordinate the ratio of the output range). P0 is (0, 0) and represents the initial time and the initial state, P3 is (1, 1) and represents the final time and the final state. Not all cubic Bézier curves are suitable as timing functions as not all are mathematical functions, i.e. curves that for a given abscissa have zero or one value. With P0 and P3 fixed as defined by CSS, a cubic Bézier curve is a function, and is therefore valid, if and only if the abscissas of P1 and P2 are both in the [0, 1] range. Cubic Bézier curves with the P1 or P2 ordinate outside the [0, 1] range may generate bouncing effects. When you specify an invalid cubic-bezier curve, CSS ignores the whole property. |
Syntax
cubic-bezier(x1, y1, x2, y2)
where :
- x1, y1, x2, y2
- Are
<number>
values representing the abscissas and ordinates of the P1 and P2 points defining the cubic Bézier curve. x1 and x2 must be in the range [0, 1] or the value is invalid.
Examples
These cubic Bézier curves are valid for use in CSS :
cubic-bezier(0.1, 0.7, 1.0, 0.1)
The canonical Bézier curve with four <number> in the [0,1] range.
cubic-bezier(0, 0, 1, 1) Using <integer> is valid as any <integer> is also a <number>.
cubic-bezier(-0.2, 0.6, -0.1, 0) Negative values for abscissas are valid, leading to bouncing effects.
cubic-bezier(1.1, 0, 4, 0) Values > 1.0 for abscissas are also valid.
These cubic Bézier curves definitions are invalid :
cubic-bezier(0.1, red, 1.0, green) Though the animated output type may be a color, Bézier curves work w/ numerical ratios.
cubic-bezier(0.1, 4, 0.6, 2.45) Ordinates must be in the [0, 1] range or the curve is not a function of time.
cubic-bezier(0.3, 2.1) The two points must be defined, there is no default value.
cubic-bezier(0.3, -1.9, 2.1, -0.2) Ordinates must be in the [0, 1] range or the curve is not a function of time.
The steps()
class of timing-functions
 |  | The steps() functional notation defines a step function dividing the domain of output values in equidistant steps. This subclass of step functions are sometimes also called staircase functions. |
steps(2, start) | steps(4, end) |
Syntax
steps(number_of_steps, direction)
where :
- number_of_steps
- Is a strictly positive
<integer>
representing the amount of equidistant treads composing the stepping function. - direction
- Is a keyword indicating if it the function is left- or right-continuous:
-
start
denotes a left-continuous function, so that the first step happens when the animation begins; -
end
denotes a right-continuous function, so that the last step happens when the animation ends.
Examples
These timing functions are valid :
steps(5, end) There is 5 treads, the last one happens right before the end of the animation.
steps(2, start) A two-step staircase, the first one happening at the start of the animation.
These timing function are invalid :
steps(2.0, end) The first parameter must be an <integer> and cannot be a real value, even if it is equal to one.
steps(-3, start) The amount of steps must be non-negative.
steps(0, end) There must be at least one step.
steps(2) The second parameter is not optional.
steps(start, 3) Though of different types, the order of parameter is important.
step(1, end) Even if there is one step, the function name is steps, with the plural 's'
steps(3 end) The two parameters must be separated with a comma; one or several spaces is not enough.
Keywords for common timing-functions
linear
 | This keyword represents the timing function cubic-bezier( 0.0, 0.0, 1.0, 1.0 ) . Using this timing function, the animation goes from its initial state to its final one regularly, with a constant speed. |
ease
 | This keyword represents the timing function cubic-bezier(0.25, 0.1, 0.25, 1.0) . This function is similar to ease-in-out , though it accelerates more sharply at the beginning and the acceleration and already starts to slow down near the medium of it. |
ease-in
 | This keyword represents the timing function cubic-bezier( 0.42, 0.0, 1.0, 1.0 ) . The animation begins slowly, then progressively accelerates until the final state is reached and the animation stops abruptly. |
ease-in-out
 | This keyword represents the timing function cubic-bezier( 0.42, 0.0, 0.58, 1.0 ) . With this timing function, the animation starts slowly, accelerates than slows down when approaching to its final state. At the begin, it behaves similarly to the ease-in function, at the end, it is similar to the ease-out function. |
ease-out
 | This keyword represents the timing function cubic-bezier( 0.0, 0.0, 0.58, 1.0 ) . The animation starts quickly then slow progressively down when approaching to its final state. |
step-start
This keyword represents the timing function steps(1, start) . Using this timing function, the animation jumps immediately to the end state and stay in that position until the end of the animation. | |
step-end
 | This keyword represents the timing function steps(1, end) . Using this timing function, the animation stays in its initial state until the end, where it directly jumps to its final position. |
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 4.0 (2.0) | (Supported) | -- | 10.5 [1]
| 3.1 |
cubic-bezier() w/ ordinate ∉ [0,1] | 4.0 (2.0) | -- | -- | -- | Nightly [2]
|
steps() | 4.0 (2.0) | -- | -- | -- | -- |
Feature | Firefox Mobile (Gecko) | Android | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 4.0 (2.0) | (Supported) | -- | 10 [3]
| 2.0 [4]
|
cubic-bezier() w/ ordinate ∉ [0,1] | 4.0 (2.0) | -- | -- | -- | -- |
steps() | 4.0 (2.0) | -- | -- | -- | 5.0 [5]
|
See also
- The
transition-timing-function
and
animation-timing-function
needing a <timing-function>
value. -
CSS Reference index
- CSS Data Types :
<angle>
, <color>
, <frequency>
, <identifier>
, <integer>
, <length>
, <number>
, <percentage>
, <ratio>
, <resolution>
, <shape>
, <string>
, <time>
, <timing-function>
, <uri>
« CSS « CSS Reference
Summary
The top
property specifies part of the position of positioned elements.
For absolutely positioned elements (those with
position
: absolute
or
position
: fixed
), it specifies the distance between the top margin edge of the element and the top edge of its containing block.
For relatively positioned elements (those with
position
: relative
), it specifies the amount the element is moved below its normal position.
Syntax
top: <length> | <percentage> | auto | inherit
Examples
/* The body could be set using px unit also for the div to operate */
body{
width: 100%;
height: 100%;
}
/* The div can now operate the settings with % unit (body w and h are set) */
div{
position:absolute;
left:15%;
top:30%;
bottom:30%;
width:70%;
height:40%;
text-align:left;
border: 3px rgb(0,0,0) solid;
}
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml" />
<title>Mozzila.org height top left width percentage CSS</title>
<style type="text/css">
/* The body could be set using px unit also for the div to operate */
body{
width: 100%;
height: 100%;
}
/* The div can now operate the settings with % unit (body w and h are set) */
div{
position:absolute;
left:15%;
top:30%;
bottom:30%;
width:70%;
height:40%;
text-align:left;
border: 3px rgb(0,0,0) solid;
}
</style>
</head>
<body>
<center>
<div>
...Some content...
</div>
</center>
</body>
</html>
Notes
top
is the more relevant property than bottom because the browser window default is to valign to the top. With some position property settings the top property is irrelevant. Top and bottom settings can be used by DHTML for more than simply the div element.
Browser compatibility
Browser | Lowest Version |
Internet Explorer | ? |
Firefox | 1 |
Netscape | ? |
Opera | ? |
Safari | ? |
« CSS « CSS Reference
Summary
The transform
CSS property lets you modify the coordinate space of the CSS visual formatting model. Using it, elements can be translated, rotated, scaled, and skewed as this text.
Syntax
transform: <transform-function> [<transform-function>]* | none
Vendor prefixes: See the compatibility table below for detail on the vendor prefixes you'll need to use for this feature.
Values
- transform-function
- One or more of the CSS transform functions to be applied, see below.
- none
- Specifies that no transform should be applied.
Examples
See Using CSS transforms.
Live Example
pre {
width: 33em;
border: solid red;
-moz-transform: translate(100px) rotate(20deg);
-moz-transform-origin: 60% 100%;
-webkit-transform: translate(100px) rotate(20deg);
-webkit-transform-origin: 60% 100%;
-o-transform:translate(100px) rotate(20deg);
-o-transform-origin:60% 100%;
-ms-transform: translate(100px) rotate(20deg);
-ms-transform-origin: 60% 100%;
transform: translate(100px) rotate(20deg);
transform-origin: 60% 100%;
}
CSS transform functions
The transform
CSS property allows the coordinate system used by an element to be manipulated using transform functions. These functions are described below.
matrix
transform: matrix(a, c, b, d, tx, ty)
/* Where a, b, c, d build the transformation matrix
┌ ┐
│ a b │
│ c d │
└ ┘
and tx, ty are the translate values. */
Specifies a 2D transformation matrix comprised of the specified six values. This is the equivalent to applying the transformation matrix [a b c d tx ty].
Note: Gecko (Firefox) accepts a
<length>
value for
tx and
ty.
Webkit (Safari, Chrome) and Opera currently support a unitless
<number>
for
tx and
ty.
Live Examples
background: gold; width: 30em;
-moz-transform: matrix(1, -0.2, 0, 1, 0, 0);
-webkit-transform: matrix(1, -0.2, 0, 1, 0, 0);
-o-transform: matrix(1, -0.2, 0, 1, 0, 0);
-ms-transform: matrix(1, -0.2, 0, 1, 0, 0);
transform: matrix(1, -0.2, 0, 1, 0, 0);
background: wheat;
max-width: intrinsic;
-moz-transform: matrix(1, 0, 0.6, 1, 15em, 0);
-webkit-transform: matrix(1, 0, 0.6, 1, 250, 0);
-o-transform: matrix(1, 0, 0.6, 1, 250, 0);
-ms-transform: matrix(1, 0, 0.6, 1, 250, 0);
transform: matrix(1, 0, 0.6, 1, 250, 0);
rotate
transform: rotate(angle); /* an <angle>, e.g. rotate(30deg) */
Rotates the element clockwise around its origin (as specified by the
transform-origin
property) by the specified angle
. The operation corresponds to the matrix [cos(angle) sin(angle) -sin(angle) cos(angle) 0 0].
scale
transform: scale(sx[, sy]); /* one or two unitless <number>s, e.g. scale(2.1,4) */
Specifies a 2D scaling operation described by [sx, sy]. If sy
isn't specified, it is assumed to be equal to sx
.
scaleX
transform: scaleX(sx); /* a unitless <number>, e.g. scaleX(2.7) */
Specifies a scale operation using the vector [sx, 1].
scaleY
transform: scaleY(sy) /* a unitless <number>, e.g. scaleY(0.3) */
Specifies a scale operation using the vector [1, sy].
skew
transform: skew(ax[, ay]) /* one or two <angle>s, e.g. skew(30deg,-10deg) */
Skews the element around the X and Y axes by the specified angles. If ay
isn't provided, no skew is performed on the Y axis.
skewX
transform: skewX(angle) /* an <angle>, e.g. skewX(-30deg) */
Skews the element around the X axis by the given angle
.
skewY
transform: skewY(angle) /* an <angle>, e.g. skewY(4deg) */
Skews the element around the Y axis by the given angle
.
translate
transform: translate(tx[, ty]) /* one or two <length> values */
Specifies a 2D translation by the vector [tx, ty]. If ty
isn't specified, its value is assumed to be zero.
translateX
transform: translateX(tx) /* see <length> for possible values */
Translates the element by the given amount along the X axis.
translateY
transform: translateY(ty) /* see <length> for possible values */
Translates the element by the given amount along the Y axis.
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 3.5 (1.9.1)
-moz
| yes
-webkit
| 9.0
-ms
| 10.5
-o
| 3.1
-webkit
|
3D Support | 10.0
-moz
| 12.0
-webkit
| 10.0
-ms
| no | 4.0
-webkit
|
Feature | iOS Safari | Opera Mini | Opera Mobile | Android Browser |
Basic support | ? | ? | ? | ? |
Notes
Internet Explorer 5.5 or later supports a proprietary Matrix Filter which can be used to achieve the similar effect.
Summary
The transform-origin
CSS property lets you modify the origin for transformations of an element. For example, the transform-origin of the rotate()
function is the centre of rotation. (This property is applied by first translating the element by the negated value of the property, then applying the element's transform, then translating by the property value.)
-
Initial value
:
50% 50%
- Applies to: all block level and inline level elements
-
Inherited
: no
- Percentages: refer to the size of the box itself
- Media:
visual
-
Computed value
: for
<length>
the absolute value, otherwise a percentage
Syntax
transform-origin: [ <percentage> | <length> | left | center | right ]
[ <percentage> | <length> | top | center | bottom ] ?
transform-origin: [ left | center | right ] || [ top | center | bottom ]
Values
Accepts one or two values.
- One single value sets the horizontal position, the vertical position is set to
50%
. - Two values apply first to the horizontal and second to the vertical position.
Combinations are allowed of keyword,
<length>
, or
<percentage>
values, but if keywords are mixed with other values, left
and right
may only be used as the first value, and top
and bottom
may only be used as the second value. Negative positions are allowed.
- <percentage>
- With a value pair of
0% 0%
, (or just 0 0
) the transform-origin is the upper left corner of the box. A value pair of 100% 100%
places the transform-origin to the lower right corner. With a value pair of 14% 84%
, the point 14% across and 84% down the box is the transform-origin. - <length>
- With a value pair of e.g.
2cm 1cm
, the transform-origin is placed 2cm to the right and 1cm below the upper left corner of the element. - top left | left top
- Same as
0 0
- top | top center | center top
- Same as
50% 0
- right top | top right
- Same as
100% 0
- left | left center | center left
- Same as
0 50%
- center | center center
- Same as
50% 50%
(default value) - right | right center | center right
- Same as
100% 50%
- bottom left | left bottom
- Same as
0 100%
- bottom | bottom center | center bottom
- Same as
50% 100%
- bottom right | right bottom
- Same as
100% 100%
Examples
See Using CSS transforms for examples.
Live Examples
transform: none; | |
transform: rotate(30deg); | |
transform: rotate(30deg); transform-origin: 0 0; | |
transform: rotate(30deg); transform-origin: 100% 100%; | |
transform: rotate(30deg); transform-origin: -10em -30em; | |
transform: scale(1.9); | |
transform: scale(1.9); transform-origin: 0 0; | |
transform: scale(1.9); transform-origin: 100% -30%; | |
transform: skew(50deg); | |
transform: skew(50deg); transform-origin: 0 0; | |
transform: skew(50deg); transform-origin: 100% 100%; | |
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 3.5 (1.9.1)
-moz
| yes
-webkit
| 9.0
-ms
| 10.5
-o
| 3.1
-webkit
|
Feature | iOS Safari | Opera Mini | Opera Mobile | Android Browser |
Basic support | ? | ? | ? | ? |
Notes
Internet Explorer 5.5 or later supports a proprietary Matrix Filter which can be used to achieve the similar effect.
DRAFT
This page is not complete.
This is an experimental feature
Because this feature is still in development in some browsers, check the compatibility table for the proper prefixes to use in various browsers.
Summary
The transform-style
CSS property determines if the children of the element are positioned in the 3D-space or are flattened in the plane of the element.
If flattened, the children will not exist on their own in the 3D-space.
As this property is not inherited, it must be set for all non-leaf descendants of the element.
Syntax
transform-style: preserve-3d or
transform-style: flat
where :
preserve-3d
- Indicates that the children of the element should be positioned in the 3D-space.
flat
- Indicates that the children of the element are lying in the plane of the element itself.
Examples
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 12
-webkit
| 10.0 (10)
-moz
| 10
-ms
| -- |
(Supported)
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 3.0
-webkit
| 10.0 (10)
-moz
| ? | -- |
(Supported)
-webkit
|
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 2
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Summary
The -moz-transition-delay
CSS property specifies the amount of time to wait between a change being requested to a property that is to be transitioned and the start of the transition effect.
A value of 0s (or 0ms) indicates that the property will begin to animate its transition immediately when the value changes; positive values will delay the start of the transition effect for the corresponding number of seconds. Negative values cause the transition to begin immediately, but to cause the transition to seem to begin partway through the animation effect.
You may specify multiple delays; each delay will be applied to the corresponding property as specified by the
-moz-transition-property
property.
Note: This implementation of the CSS transition-delay
property is based on a draft specification; the syntax is subject to change.
Syntax
-moz-transition-delay: <time>[, <time>]*
Values
- time
- The time (in seconds or milliseconds) to wait between a property's value changing and the start of the animation effect. A time in seconds is represented by a number followed by "s", while a time in milliseconds is a number followed by "ms".
Examples
There are several examples of CSS transitions included in the main CSS transitions article.
Browser compatibility
Browser | Lowest Version |
Internet Explorer | --- |
Firefox (Gecko) | 4.0 (2.0) |
Opera | --- |
Safari (WebKit) | nightly, don't know version
|
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 2
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Summary
The -moz-transition-duration
CSS property specifies the number of seconds or milliseconds a transition animation should take to complete. By default, the value is 0s, meaning that no animation will occur.
You may specify multiple durations; each duration will be applied to the corresponding property as specified by the
-moz-transition-property
property.
Note: This implementation of the CSS transition-duration
property is based on a draft specification; the syntax is subject to change.
Syntax
-moz-transition-duration: <time>[, <time>]*
Values
- time
- The time (in seconds or milliseconds) the transition from the old value of a property to the new value should take. A time in seconds is represented by a number followed by "s", while a time in milliseconds is a number followed by "ms".
Examples
There are several examples of CSS transitions included in the main CSS transitions article.
Browser compatibility
Browser | Lowest Version |
Internet Explorer | --- |
Firefox (Gecko) | 4.0? (2.0) |
Opera | --- |
Safari (WebKit) | nightly, don't know version |
« CSS « CSS Reference
Introduced in Gecko 2
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Syntax
-moz-transition: [ <transition-property> || <transition-duration> || <transition-timing-function> || <transition-delay> ]
See When property value lists are of different lengths for details on how things are handled when lists of property values aren't the same length. In short, extra transition descriptions beyond the number of properties actually being animated are ignored.
Examples
There are several more examples of CSS transitions included in the main CSS transitions article.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | 1.0 (-webkit-) | 4.0 (2.0)
(-moz-) | - | 10.5 | 3.0 (-webkit-) |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Introduced in Gecko 2
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Summary
The -moz-transition-property
CSS property is used to specify the names of CSS properties to which a transition effect should be applied.
Note: The set of properties that can be animated is subject to change; as such, you should avoid including any properties in the list that don't currently animate, because someday they might, causing unexpected results.
If you specify a shorthand property (for example,
background
, all of its longhand sub-properties that can be animated will be.
Note: This implementation of the CSS transition-property
property is based on a draft specification; the syntax is subject to change.
Syntax
-moz-transition-property: none | all | [<property-name>][, <property-name>]*
Values
- none
- No properties will transition.
- all
- All properties that can have an animated transition will do so.
- property-name
- A property to which a transition effect should be applied when its value changes.
Examples
There are several examples of CSS transitions included in the main CSS transitions article.
Browser compatibility
Browser | Lowest Version |
Internet Explorer | --- |
Firefox (Gecko) | 4.0 (2.0) |
Opera | --- |
Safari (WebKit) | nightly, don't know version |
« CSS « CSS Reference
Summary
The transition-timing-function
CSS property is used to describe how the intermediate values of the CSS properties being affected by a transition effect are calculated. This in essence lets you establish an acceleration curve, so that the speed of the transition can vary over its duration.
This acceleration curve is defined using one
<timing-function>
for each property to be transitioned.
Note: This implementation of the CSS transition-timing-function
is based on a draft specification and is therefore experimental : the syntax is subject to change.
Examples
There are several examples of CSS transitions included in the main CSS transitions article.
Browser compatibility
Browser | Lowest Version |
Internet Explorer | --- |
Firefox (Gecko) | 4.0 (2.0)
-moz
|
Opera | --- |
Safari (WebKit) | 3.1
-webkit
|
« CSS « CSS Reference
The unicode-bidi
property together with the
direction
property relates to the handling of bidirectional text in a document. For example, if a block of text contains both left-to-right and right-to-left text then the user-agent uses a complex Unicode algorithm to decide how to display the text. This property overrides this algorithm and allows the developer to control the text embedding.
Note: This property is intended for DTD designers. Web designers and similar authors should not override it.
Syntax
unicode-bidi: [ normal | embed | [ isolate || bidi-override ] | plaintext | inherit ] ;
Values
normal
- The element does not offer a additional level of embedding with respect to the bidirectional algorithm. For inline elements implicit reordering works across element boundaries.
embed
- If the element is inline, this value opens an additional level of embedding with respect to the bidirectional algorithm. The direction of this embedding level is given by the
direction
property. bidi-override
- For inline elements this creates an override. For block container elements this creates an override for inline-level descendants not within another block container element. This means that inside the element, reordering is strictly in sequence according to the
direction
property; the implicit part of the bidirectional algorithm is ignored. isolate
- This keyword indicates that the element's container directionality should be calculated without considering the content of this element. The element is therefore isolated from its siblings. When applying its bidirectional-resolution algorithm, its container element treats it as one or several
U+FFFC Object Replacement Character
, i.e. like an image. This keyword can be combined with bidi-override.
plaintext
- This keyword makes the elements directionality calculated without considering its parent bidirectional state or the value of the
direction
property. The directionality is calculated using the P2 and P3 rules of the Unicode Bidirectional Algorithm.
This value allows to display data which has already formatted using a tool following the Unicode Bidirectional Algorithm.
Examples
.bible-quote {
direction: rtl; unicode-bidi: embed;
}
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 2.0 | 1.0 (1.7 or earlier)
| 5.5 | 9.2 | 1.3 |
isolate | 16 | 10.0 (10)
[1]
| -- | -- | -- |
plaintext | -- | 10.0 (10)
[2]
| -- | -- | -- |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 1.0 | 1.0 (1.0)
| 6 | 8 | 3.1 |
isolate | -- | 10.0 (10)
[3]
| -- | -- | -- |
plaintext | -- | 10.0 (10)
[4]
| -- | -- | -- |
Summary
The <url>
CSS data type denotes a pointer to a resource. It has no proper syntax and can only be expressed through the url()
functional notation.
URI or URL? There is a difference between a
URI and a
URL. A URL describes the location of the resource, the URI describes an id of the resource . A URI may be a location, a URL, or a name, a
URN, of a resource.
In CSS Level 1, the
url()
functional notation was introduced to describe... URL, i.e. locations (a
<url>
CSS data type, though it wasn't explicitly defined that way).
In CSS Level 2, the same functional notation was extended to describe any URI, being a URL or URN. This led to the confusing fact that
url()
was used to create a
<uri>
CSS data type. Not only was this confusing, but URN are almost never used in the CSS usual case.
To fix this, CSS Level 3 came back to the initial definition, this time explicitly defined. The functional notation
url()
denotes a
<url>
CSS data type and no more the more generic
<uri>
CSS data type.
Remark that these semantic details doesn't change much for a web author, or the implementation details of the data type.
Many CSS properties take a URL as value, such as
background-image
,
cursor
,
@font-face
,
list-style
etc.
The url() functional notation
The URI may be quoted by simple quotes or double quotes. Relative URIs are allowed and are relative to the URL of stylesheet (and not to the URL of the web page).
Syntax
<a_css_property>: url("http://mysite.example.com/mycursor.png")
<a_css_property>: url(http://mysite.example.com/mycursor.png)
Examples
.topbanner { background: url("topbanner.png") #00D no-repeat fixed; }
ul { list-style: square url(http://www.example.com/redball.png) }
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 1.0 | 1.0 (1.0) | 3.0 | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | 1.0 | 1.0 (3.5) | yes | yes | 1.0 |
See also
-
CSS Reference index
- CSS Data Types :
<angle>
, <color>
, <frequency>
, <identifier>
, <integer>
, <length>
, <number>
, <percentage>
, <ratio>
, <resolution>
, <shape>
, <string>
, <time>
, <timing-function>
, <uri>
« CSS « CSS Reference
Summary
The vertical-align property specifies the vertical alignment of an inline or table-cell element.
Syntax
vertical-align:
baseline
| sub
| super
| text-top
| text-bottom
| middle
| top
| bottom
| <percentage> | <length> |
inherit
Values (for inline elements)
Most of the values vertically align the element relative to its parent element:
- baseline
- Align the baseline of the element with the baseline of its parent.
- sub
- Align the baseline of the element with the subscript-baseline of its parent.
- super
- Align the baseline of the element with the superscript-baseline of its parent.
- text-top
- Align the top of the element with the top of the parent element's font.
- text-bottom
- Align the bottom of the element with the bottom of the parent element's font.
- middle
- Align the middle of the element with the middle of lowercase letters in the parent.
-
<length>
- Align the baseline of the element at the given length above the baseline of its parent.
- <percentage>
- like <length> values, with the percentage being a percent of the
line-height
property
For elements that do not have a baseline, the bottom margin edge is used instead.
However, two values vertically align the element relative to the entire line rather than relative to its parent:
- top
- Align the top of the element and its descendants with the top of the entire line.
- bottom
- Align the bottom of the element and its descendants with the bottom of the entire line.
Negative values are allowed.
Values (for table cells)
- baseline (and sub, super, text-top, text-bottom, <length>, and <percentage>)
- Align the baseline of the cell with the baseline of all other cells in the row that are baseline-aligned.
- top
- Align the top padding edge of the cell with the top of the row.
- middle
- Center the padding box of the cell within the row.
- bottom
- Align the bottom padding edge of the cell with the bottom of the row.
Negative values are allowed.
Examples
img {
vertical-align: bottom;
}
Notes
Browser compatibility
Browser | lowest version |
Internet Explorer | 4.0 |
Firefox (Gecko) | 1.0 (1.0) |
Opera | 4.0 |
Safari (WebKit) | 1.0 (85) |
« CSS « CSS Reference
Summary
The visibility
CSS property is used for two things:
- The
hidden
value hides an element but leaves space where it would have been. - The
collapse
value hides rows or columns of a table. It also collapses XUL elements.
Syntax
visibility: visible | hidden | collapse |
inherit
Values
- visible
- Default value, the box is visible.
- hidden
- The box is invisible (fully transparent, nothing is drawn), but still affects layout. Descendants of the element will be visible if they have
visibility:visible
(this doesn't work in IE up to version 7). - collapse
- For table rows, columns, column groups, and row groups the row(s) or column(s) are hidden and the space they would have occupied is (as if
display
: none
were applied to the column/row of the table). However, the size of other rows and columns is still calculated as though the cells in the collapsed row(s) or column(s) are present. This was designed for fast removal of a row/column from a table without having to recalculate widths and heights for every portion of the table. For XUL elements, the computed size of the element is always zero, regardless of other styles that would normally affect the size, although margins still take effect. For other elements, collapse
is treated the same as hidden
.
Examples
p { visibility: hidden; } /* paragraphs won't be visible */
p.showme { visibility: visible; } /* except of these with class showme */
tr.col { visibility: collapse; } /* table rows with class col will collapse */
Notes
The support for visibility:collapse
is missing or partially incorrect in some modern browsers. In many cases it may not be correctly treated like visibility:hidden
on elements other than table rows and columns.
visibility:collapse
may change the layout of a table if the table has nested tables within the cells that are collapsed, unless visibility:visible
is specified explicitly on nested tables.
Browser compatibility
Browser | Lowest version |
Internet Explorer | 4.0 |
Firefox (Gecko) | 1.0 (1.0) |
Opera | 4.0 |
Safari (WebKit) | 1.0 (85) |
CSS property: -webkit-animation-delay
Description
Defines when an animation starts.
This property allows an animation to begin execution some time after it is applied.
Syntax
-webkit-animation-delay: <time> [, ...];
Values
- <time>
-
The time to begin executing an animation after it is applied. If 0
, the animation executes as soon as it is applied. If positive, it specifies an offset from the moment the animation is applied, and the animation delays execution by that offset. If negative, the animation executes the moment the property changes but appears to begin at the specified negative offset—that is, begins part-way through the animation. Nonzero values must specify a unit: s
for seconds, ms
for milliseconds.
0 (by default) |
The default value is 0 . |
now |
The animation begins immediately. Available in iOS 2.0 and later. |
CSS property: -webkit-animation-direction
Description
Determines whether the animation should play in reverse on alternate iterations.
Syntax
-webkit-animation-direction: <direction> [, …];
Values
- <direction>
-
The direction to play.
normal (by default) |
Play each iteration of the animation in the forward direction. |
alternate |
Play even-numbered iterations of the animation in the forward direction and odd-numbered iterations in the reverse direction.
When an animation is played in reverse, the timing functions are also reversed. For example, when played in reverse, an ease-in animation appears as an ease-out animation.
|
CSS property: -webkit-animation-duration
Description
Specifies the length of time that an animation takes to complete one iteration.
Syntax
-webkit-animation-duration: <time> [, ...];
Values
- <time>
-
The duration of an animation. If 0
, the animation iteration is immediate (there is no animation). A negative value is treated as 0
.
0 (by default) |
The default value is 0 . |
CSS property: -webkit-animation-fill-mode
Description
Specifies whether the effects of an animation are apparent before the animation starts and after it ends.
By default, an animation starts as soon as the style that describes the animation is applied to an element; however, the -webkit-animation-delay property can delay the start of an animation. Specifying a value of backwards or both for this property overrides the -webkit-animation-delay property and tells the animation to start as soon as the style is applied.
Syntax
-webkit-animation-fill-mode: <mode> [, ...];
Values
- <mode>
-
The animation's fill mode. Can be none
, forwards
, backwards
, or both
.
none |
The effects of the animation are apparent only during the defined duration of the animation. |
forwards |
The animation’s final keyframe continues to apply after the final iteration of the animation completes. |
backwards |
The animation’s initial keyframe is applied as soon as the animation style is applied to an element. This only affects animations that have a nonzero value for -webkit-animation-delay. |
both |
The animation’s initial keyframe is applied as soon as the animation style is applied to an element, and the animation’s final keyframe continues to apply after the final iteration of the animation completes. The initial keyframe only affects animations that have a nonzero value for -webkit-animation-delay. |
CSS property: -webkit-animation
Description
Combines common animation properties into a single property.
Refer to the respective property for details of each property and default values.
Syntax
-webkit-animation: <name> <duration> <timing_function> <delay> <iteration_count> <direction> [, ... ];
CSS property: -webkit-animation-iteration-count
Description
Specifies the number of times an animation iterates.
This property is often used with a -webkit-animation-direction property set to alternate, which causes the animation to play in reverse on alternate iterations.
Syntax
-webkit-animation-iteration-count: <number> [, …];
Values
- <number>
-
The number of iterations. If 1
, the animation plays from beginning to end once. A value of infinite
causes the animation to repeat forever. Noninteger values cause the animation to end partway through an interation. Negative values are invalid.
1 (by default) |
The default value is 1 . |
infinite |
Repeats the animation forever. |
CSS property: -webkit-animation-name
Description
Specifies the name of an animation.
Syntax
-webkit-animation-name: <name> [, …];
Values
- <name>
-
The name of the animation.
The name is used to select the -webkit-keyframe
at-rule that provides the keyframes and property values for the animation. If the name does not match any -webkit-keyframe
at-rule, there are no properties to be animated and the animation is not executed. See @-webkit-keyframes for a description of this rule.
If "none"
, no animation is executed even if there is a -webkit-keyframe
at-rule with that name. Setting this property to "none"
explicitly disables animations.
"" |
The default value is "" . |
CSS property: -webkit-animation-play-state
Description
Determines whether the animation is running or paused.
A running animation can be paused by setting this property to paused
. Set this property to running
to continue running a paused animation. A paused animation continues to display the current value of the animation in a static state. When a paused animation is resumed, it restarts from the current value, not from the beginning of the animation.
Syntax
-webkit-animation-play-state: <play_state> [, ...];
Values
- <play_state>
-
The state of an animation.
running (by default) |
Plays the animation. |
paused |
Pauses the animation. |
CSS property: -webkit-animation-timing-function
Description
Defines how an animation progresses between keyframes.
The timing function is specified using a cubic Bezier curve.
Use the constants to specify preset points of the curve or
the cubic-bezier
function to specify your own points.
See cubic-bezier
for a description of the parameters for this function.
See "Visual Effects Timing Functions"
for additional information about timing functions.
This property applies between keyframes, not over the entire animation.
For example, for an ease-in-out
timing function, an animation eases
in at the start of the keyframe and eases out at the end of the keyframe.
A -webkit-animation-timing-function defined within a keyframe block
applies to that keyframe; otherwise, the timing function specified for the animation is used.
Syntax
-webkit-animation-timing-function: <function> [, …];
Values
- <function>
-
The function to apply between keyframes.
ease |
Equivalent to cubic-bezier(0.25, 0.1, 0.25, 1.0) . |
linear |
Equivalent to cubic-bezier(0.0, 0.0, 1.0, 1.0) . |
ease-in |
Equivalent to cubic-bezier(0.42, 0, 1.0, 1.0) . |
ease-out |
Equivalent to cubic-bezier(0, 0, 0.58, 1.0) . |
ease-in-out |
Equivalent to cubic-bezier(0.42, 0, 0.58, 1.0) . |
CSS property: -webkit-appearance
Description
Changes the appearance of buttons and other controls to resemble native controls.
Syntax
-webkit-appearance: <appearance>;
Values
- <appearance>
-
The appearance of the control.
caps-lock-indicator |
The indicator that appears in a password field when Caps Lock is active. Available in Safari 4.0 and later. Available in iOS 2.0 and later. |
button |
|
button-bevel |
|
caret |
|
checkbox |
|
default-button |
|
listbox |
|
listitem |
|
media-fullscreen-button |
|
media-mute-button |
|
media-play-button |
|
media-seek-back-button |
|
media-seek-forward-button |
|
media-slider |
|
media-sliderthumb |
|
menulist |
|
menulist-button |
|
menulist-text |
|
menulist-textfield |
|
none |
|
push-button |
|
radio |
|
searchfield |
|
searchfield-cancel-button |
|
searchfield-decoration |
|
searchfield-results-button |
|
searchfield-results-decoration |
|
slider-horizontal, slider-vertical |
|
sliderthumb-horizontal |
|
sliderthumb-vertical |
|
square-button |
|
textarea |
|
textfield |
|
scrollbarbutton-down |
Unsupported in Safari 4.0 |
scrollbarbutton-left |
Unsupported in Safari 4.0 |
scrollbarbutton-right |
Unsupported in Safari 4.0 |
scrollbarbutton-up |
Unsupported in Safari 4.0 |
scrollbargripper-horizontal |
Unsupported in Safari 4.0 |
scrollbargripper-vertical |
Unsupported in Safari 4.0 |
scrollbarthumb-horizontal |
Unsupported in Safari 4.0 |
scrollbarthumb-vertical |
Unsupported in Safari 4.0 |
scrollbartrack-horizontal |
Unsupported in Safari 4.0 |
scrollbartrack-vertical |
Unsupported in Safari 4.0 |
CSS property: -webkit-backface-visibility
Description
Determines whether or not a transformed element is visible when it is not facing the screen.
Use this property to specify whether or not an element is visible when it is not facing the screen. For example, if the identity transform is set, an element faces the screen; otherwise, it may face away from the screen. For example, applying a rotation about y of 180 degrees in the absence of any other transforms causes an element to face away from the screen.
This property is useful when you place two elements back to back, as you would do to create a playing card. Without this property, the front and back elements could at times switch places during an animation to flip the card. Another example is creating a box out of six elements whose outside and inside faces can be viewed. This is useful when creating the backdrop for a three-dimensional stage.
Syntax
-webkit-backface-visibility: <visibility>;
Values
- <visibility>
-
Determines whether or not the back face of a transformed element is visible.
visible (by default) |
The element is always visible even when it is not facing the screen. |
hidden |
The element is invisible if it is not facing the screen. |
CSS property: -webkit-background-clip
Description
Specifies the clipping behavior of the background of a box.
Syntax
-webkit-background-clip: <behavior>;
Values
- <behavior>
-
The clipping behavior of the background.
border |
The background clips to the border of the box. |
content |
The background clips to the content of the box. |
padding |
The background clips to the padding of the box. |
text |
The background clips to the text of the box. Available in Safari 4.0 and later. |
CSS property: -webkit-background-composite
Description
Sets a compositing style for background images and colors.
Syntax
-webkit-background-composite: <compositing_style>;
Values
- <compositing_style>
-
The compositing style of the background.
border |
The background extends into the border area |
padding |
The background extends only into the padding area enclosed by the border |
CSS property: -webkit-background-origin
Description
Determines where the background-position property is anchored.
The background position can be anchored at the upper-left corner of the border, the upper-left corner of the padding area inside the border, or the upper-left corner of the content inside the padding area.
Syntax
-webkit-background-origin: <origin>;
Values
- <origin>
The origin of the background position.
CSS property: -webkit-background-size
Description
Overrides the size of a background image.
Changes to this property can be animated in Safari 4.0 and later.
Syntax
-webkit-background-size: <length>;
-webkit-background-size: <length_x> <length_y>;
Values
- <length>
The width and height of the background image.
- <length_x>
The width of the background image.
- <length_y>
The height of the background image.
CSS property: -webkit-border-bottom-left-radius
Description
Specifies that the bottom-left corner of a box be rounded with the specified radius.
Syntax
-webkit-border-bottom-left-radius: <radius>;
-webkit-border-bottom-left-radius: <horizontal_radius> <vertical_radius>;
Values
- <radius>
The radius of the rounded corner.
- <horizontal_radius>
The horizontal radius of the rounded corner.
- <vertical_radius>
The vertical radius of the rounded corner.
CSS property: -webkit-border-bottom-right-radius
Description
Specifies that the bottom-right corner of a box be rounded with the specified radius.
Syntax
-webkit-border-bottom-right-radius: <radius>;
-webkit-border-bottom-right-radius: <horizontal_radius> <vertical_radius>;
Values
- <radius>
The radius of the rounded corner.
- <horizontal_radius>
The horizontal radius of the rounded corner.
- <vertical_radius>
The vertical radius of the rounded corner.
CSS property: -webkit-border-horizontal-spacing
Description
Defines the spacing between the horizontal portion of an element’s border and the content within.
Equivalent to the horizontal portion of the border-spacing property. Changes to this property can be animated.
Syntax
-webkit-border-horizontal-spacing: <spacing>;
Values
- <spacing>
The amount of horizontal spacing.
CSS property: -webkit-border-image
Description
Specifies an image as the border for a box.
The specified image is cut into nine pieces according to the length values given. This property applies to any box, including inline elements, but does not apply to table cells if the border-collapse property is set to collapse
.
The first five fields are required. The <uri>
field contains the URI for the image. The four inset values that follow represent distances from the top, right, bottom, and left edges of the image. If no unit is specified, they represent actual pixels in the original image (assuming a raster image). If a unit (such as px) is specified, they represent CSS units (which may or may not be the same thing). The values may also be specified as a percentage of the size of the image.
After the required fields, you can optionally include a slash (/
) followed by a border width field or fields. You can specify all four border widths individually or specify a single value that applies to all four fields. If these values are not the same size as the inset values, the slices of the original image are scaled to fit.
Finally, you can specify a repeat style in each direction. These values affect how the top, bottom, left, right, and center portions are altered to fit the required dimensions, and can be any of the following: repeat
(tiled), stretch
, or round
(the round style is like tiling, except that it stretches all nine pieces slightly so that there is no partial tile at the end).
Syntax
-webkit-border-image: <uri> <top> <right> <bottom> <left> <x_repeat> <y_repeat>;
-webkit-border-image: <uri> <top> <right> <bottom> <left> / <border> <x_repeat> <y_repeat>;
-webkit-border-image: <uri> <top> <right> <bottom> <left> / <top_border> <right_border> <bottom_border> <left_border> <x_repeat> <y_repeat>;
-webkit-border-image: <function> <top> <right> <bottom> <left> / <top_border> <right_border> <bottom_border> <left_border> <x_repeat> <y_repeat>;
Values
- <uri>
The file path of the image.
- <top>
The distance from the top edge of the image.
- <right>
The distance from the right edge of the image.
- <bottom>
The distance from the bottom edge of the image.
- <left>
The distance from the left edge of the image.
- <x_repeat>
-
The horizontal repeat style.
repeat (by default) |
The image is tiled. |
round |
The image is stretched before it is tiled to prevent partial tiles. |
stretch |
The image is stretched to the size of the border. |
- <y_repeat>
-
The vertical repeat style.
repeat (by default) |
The image is tiled. |
round |
The image is stretched before it is tiled to prevent partial tiles. |
stretch |
The image is stretched to the size of the border. |
- <border>
The width of the border on all sides.
- <top_border>
The width of the top border.
- <right_border>
The width of the right border.
- <bottom_border>
The width of the bottom border.
- <left_border>
The width of the left border.
- <function>
A function that procedurally generates an image, such as gradient
.
Examples
h1 {
-webkit-border-image: url("border.png") 25;
border: solid 25px #f00;
}
p {
-webkit-border-image: url("border.png") 5 10 5 10 repeat;
border: solid 10px #f00;
}
CSS property: -webkit-border-radius
Description
Specifies that the corners of a box be rounded with the specified radius.
Syntax
-webkit-border-radius: <radius>;
-webkit-border-radius: <horizontal_radius> <vertical_radius>;
Values
- <radius>
The radius of the rounded corners.
- <horizontal_radius>
The horizontal radius of the rounded corners.
- <vertical_radius>
The vertical radius of the rounded corners.
Examples
div {
-webkit-border-radius: 10px;
}
CSS property: -webkit-border-top-left-radius
Description
Specifies that the top-left corner of a box be rounded with the specified radius.
Syntax
-webkit-border-top-left-radius: <radius>;
-webkit-border-top-left-radius: <horizontal_radius> <vertical_radius>;
Values
- <radius>
The radius of the rounded corner.
- <horizontal_radius>
The horizontal radius of the rounded corner.
- <vertical_radius>
The vertical radius of the rounded corner.
CSS property: -webkit-border-top-right-radius
Description
Specifies that the top-right corner of a box be rounded with the specified radius.
Syntax
-webkit-border-top-right-radius: <radius>;
-webkit-border-top-right-radius: <horizontal_radius> <vertical_radius>;
Values
- <radius>
The radius of the rounded corner.
- <horizontal_radius>
The horizontal radius of the rounded corner.
- <vertical_radius>
The vertical radius of the rounded corner.
CSS property: -webkit-border-vertical-spacing
Description
Defines the spacing between the vertical portion of an element’s border and the content within.
Equivalent to the vertical portion of the border-spacing property. Changes to this property can be animated.
Syntax
-webkit-border-vertical-spacing: <spacing>;
Values
- <spacing>
The amount of vertical spacing.
CSS property: -webkit-box-align
Description
Specifies the alignment of nested elements within an outer flexible box element.
This property specifies the horizontal alignment if the box direction is vertical, and vice versa. This property applies only to flexible box layouts. For more information about flexible boxes, see http://www.w3.org/TR/css3-layout/.
Syntax
-webkit-box-align: baseline | center | end | start | stretch;
Values
- baseline
Elements are aligned with the baseline of the box.
- center
Elements are aligned with the center of the box.
- end
Elements are aligned with the end of the box.
- start
Elements are aligned with the start of the box.
- stretch
Elements are stretched to fill the box.
CSS property: -webkit-box-direction
Description
Specifies the direction in which child elements of a flexible box element are laid out.
This applies only to flexible box layouts. For more information about flexible boxes, see http://www.w3.org/TR/css3-layout/.
Syntax
-webkit-box-direction: normal | reverse;
Values
- normal (by default)
Elements are laid out in the default direction.
- reverse
Elements are laid out in the reverse direction.
CSS property: -webkit-box-flex-group
Description
Specifies groups of dynamically resizing elements that are adjusted to be the same size.
During size adjustment of flex boxes, any boxes with the same group number are adjusted to be the same size.
This property applies only to flexible box layouts. For more information about flexible boxes, see http://www.w3.org/TR/css3-layout/.
Syntax
-webkit-box-flex-group: <group_number>;
Values
- <group_number>
The group number of the flexible element. Integer, nonnegative value.
CSS property: -webkit-box-flex
Description
Specifies an element’s flexibility.
Flexible elements can stretch or shrink to fit the size of the bounding box of their parent element. The amount of stretching or shrinkage of an element is determined by its flex value relative to the flex values of other elements within the same parent element.
This property applies only to flexible box layouts. For more information about flexible boxes, see http://www.w3.org/TR/css3-layout/
Syntax
-webkit-box-flex: <flex_value>;
Values
- <flex_value>
Floating-point number. The flexibility of the element.
CSS property: -webkit-box-lines
Description
Specifies whether a flexible box should contain multiple lines of content.
This property applies only to flexible box layouts. For more information about flexible boxes, see http://www.w3.org/TR/css3-layout/.
Syntax
-webkit-box-lines: <behavior>;
Values
- <behavior>
-
If multiple
, the flexible box can contain multiple lines of content; if single
, only one line is allowed.
multiple |
The box can contain multiple lines of content. |
single |
The box can contain only one line of content. |
CSS property: -webkit-box-ordinal-group
Description
Specifies a rough ordering of elements in a flexible box.
Elements with lower ordinal group values are displayed first.
This property applies only to flexible box layouts. For more information about flexible boxes, see http://www.w3.org/TR/css3-layout/.
Syntax
-webkit-box-ordinal-group: <group_number>;
Values
- <group_number>
The ordinal group number of the element. Integer, nonnegative value.
CSS property: -webkit-box-orient
Description
Specifies the layout of elements nested within a flexible box element.
This property applies only to flexible box layouts. For more information about flexible boxes, see http://www.w3.org/TR/css3-layout/.
Syntax
-webkit-box-orient: <orientation>;
Values
- <orientation>
-
The orientation of elements nested in the flexible box.
block-axis |
Elements are oriented along the box's axis. |
horizontal |
Elements are oriented horizontally. |
inline-axis |
Elements are oriented along the inline axis. |
vertical |
Elements are oriented vertically. |
CSS property: -webkit-box-pack
Description
Specifies alignment of child elements within the current element in the direction of orientation.
For elements whose children are aligned horizontally, a packing value of start
indicates left alignment with extra space towards the right side, a value of end
indicates right alignment with extra space to the left, a value of center
indicates center alignment with extra space split evenly on either side, and a value of justify
indicates that the outer elements should be aligned on the left and right, with space added evenly between the elements.
Similarly, for elements whose children are aligned vertically, a value of start
indicates that the elements should be aligned to the top, a value of end indicates that the elements should be aligned to the bottom, and so on.
This property is similar to -webkit-box-align, which specifies alignment in the opposite direction from the direction of orientation.
This property applies only to flexible box layouts. For more information about flexible boxes, see http://www.w3.org/TR/css3-layout/.
Syntax
-webkit-box-pack: <alignment>;
Values
- <alignment>
-
The alignment of child elements.
center |
Child elements are aligned to the center of the element. |
end |
Child elements are aligned to the end of the element. |
justify |
Child elements are justified with both the start and end of the element. |
start |
Child elements are aligned to the start of the element. |
CSS property: -webkit-box-reflect
Description
Defines a reflection of a border box.
Reflections will update automatically as the source changes. Specifying a reflection has the effect of creating a stacking context (like opacity, masks, and transforms). The reflection is non-interactive, and as such, it has no effect on hit testing. The reflection has no effect on layout, other than being part of a container’s overflow; it is similar to -webkit-box-shadow in this respect.
Syntax
-webkit-box-reflect: <direction> <offset> <mask-box-image>;
Values
- <direction>
-
The position of the reflection relative to the border box.
above |
The reflection appears above the border box. |
below |
The reflection appears below the border box. |
left |
The reflection appears to the left of the border box. |
right |
The reflection appears to the right of the border box. |
- <offset>
-
The distance of the reflection from the edge of the border box, in length units or as a percentage.
0 (by default) |
The default value is 0
|
- <mask-box-image>
Used to overlay the reflection. If omitted, the reflection has no mask.
CSS property: -webkit-box-shadow
Description
Applies a drop shadow effect to the border box of an object.
This property takes four parameters. The first two are horizontal and vertical offsets—down for horizontal, and to the right for vertical. The third value is a blur radius. The fourth value is the color of the shadow. Changes to this property can be animated.
Syntax
-webkit-box-shadow: none;
-webkit-box-shadow: <hoff> <voff> <blur> <color>;
Values
- none (by default)
The box has no shadow.
- <hoff>
The horizontal offset of the shadow.
- <voff>
The vertical offset of the shadow.
- <blur>
The blur radius of the shadow.
- <color>
The color of the shadow.
CSS property: -webkit-box-sizing
Description
Specifies that the size of a box be measured according to either its content (default) or its total size including borders.
Syntax
-webkit-box-sizing: <sizing_model>;
Values
- <sizing_model>
-
The model by which the size of the box is measured.
border-box |
The box size includes borders in addition to content. |
content-box (by default) |
The box size only includes content. |
CSS property: -webkit-column-break-after
Description
Determines whether a column break can and should occur after an element in a multicolumn flow layout.
Syntax
-webkit-column-break-after: <policy>;
Values
- <policy>
-
The column break policy.
always |
A column break is always inserted after the element. |
auto (by default) |
A right column break is inserted after the element where appropriate. |
avoid |
Column breaks are avoided after the element. |
left |
A left column break is inserted after the element. |
right |
A right column break is inserted after the element. |
CSS property: -webkit-column-break-before
Description
Determines whether a column break can and should occur before an element in a multicolumn flow layout.
Syntax
-webkit-column-break-before: <policy>;
Values
- <policy>
-
The column break policy.
always |
A column break is always inserted before the element. |
auto (by default) |
A right column break is inserted before the element where appropriate. |
avoid |
Column breaks are avoided before the element. |
left |
A left column break is inserted before the element. |
right |
A right column break is inserted before the element. |
CSS property: -webkit-column-break-inside
Description
Determines whether a column break should be avoided within the bounds of an element in a multicolumn flow layout.
Syntax
-webkit-column-break-inside: <policy>;
Values
- <policy>
-
The column break policy.
auto (by default) |
A right column break is inserted within the element where appropriate. |
avoid |
Column breaks are avoided within the element. |
CSS property: -webkit-column-count
Description
Specifies the number of columns desired in a multicolumn flow.
Changes to this property can be animated.
Syntax
-webkit-column-count: auto | <number_of_columns>;
Values
- auto (by default)
- The element has one column.
- <number_of_columns>
The number of columns in the multicolumn flow. Integer, nonnegative value.
CSS property: -webkit-column-gap
Description
Specifies the space between columns in a multicolumn flow.
Changes to this property can be animated.
Syntax
-webkit-column-gap: normal | <width>;
Values
- normal (by default)
- Columns in the element have the normal gap width between them.
- <width>
The width of the gap. Length unit.
CSS property: -webkit-column-rule-color
Description
Specifies the color of the column rule.
Changes to this property can be animated.
Syntax
-webkit-column-rule-color: <color>;
Values
- <color>
-
The color of the column rule.
currentcolor |
The value of the element's color property. |
-webkit-activelink |
The default color of a hyperlink that is being clicked. |
-webkit-focus-ring-color |
The color that surrounds a UI element, such as a text field, that has focus. |
-webkit-link |
The default color of a hyperlink that has been visited. |
-webkit-text |
The default text color. |
CSS property: -webkit-column-rule
Syntax
-webkit-column-rule: <width> <style> <color>;
Values
- <width>
The width of the column rule.
- <style>
The style of the column rule.
- <color>
The color of the column rule.
CSS property: -webkit-column-rule-style
Description
Specifies the style of the column rule.
Syntax
-webkit-column-rule-style: <style>;
Values
- <style>
-
The style of the column rule.
dashed |
The column rule has a dashed line style. |
dotted |
The column rule has a dotted line style. |
double |
The column rule has a double solid line style. |
groove |
The column rule has a grooved style. |
hidden |
The column rule is hidden. |
inset |
The column rule has an inset style. |
none (by default) |
The column rule has no style. |
outset |
The column rule has an outset style. |
ridge |
The column rule has a ridged style. |
solid |
The column rule has a solid line style. |
CSS property: -webkit-column-rule-width
Description
Specifies the width of the column rule.
Changes to this property can be animated.
Syntax
-webkit-column-rule-width: medium | thick | thin | <width>;
Values
- medium
The column rule has a medium width.
- thick
The column rule has a thick width.
- thin
The column rule has a thin width.
- <width>
The width of the column rule. Length unit.
CSS property: -webkit-columns
Syntax
-webkit-columns: <width> <count>;
Values
- <width>
The width of each column.
- <count>
The number of columns.
CSS property: -webkit-column-width
Description
Specifies the width of the column in a multicolumn flow.
Changes to this property can be animated.
Syntax
-webkit-column-width: <width>;
Values
- auto (by default)
Columns in the element are of normal width.
- <width>
The width of the column. Length unit.
CSS property: -webkit-dashboard-region
Syntax
-webkit-dashboard-region: none | dashboard-region(...) [...];
Values
- none
No behavior is specified.
CSS property: -webkit-line-break
Description
Specifies line-breaking rules for CJK (Chinese, Japanese, and Korean) text.
Syntax
-webkit-line-break: after-white-space | normal;
Values
- after-white-space
The line breaks after white space.
- normal (by default)
A standard line-breaking rule
CSS property: -webkit-margin-bottom-collapse
Description
Specifies the behavior of an element’s bottom margin if it is adjacent to an element with a margin. Elements can maintain their respective margins or share a single margin between them.
This property allows you to emulate the behavior of some browsers in quirks mode where table cell margins are collapsed into the borders of vertically adjacent cells.
Syntax
-webkit-margin-bottom-collapse: collapse | discard | separate;
Values
- collapse
Two adjacent margins are collapsed into a single margin.
- discard
The element’s margin is discarded if it is adjacent to another element with a margin.
- separate
Two adjacent margins remain separate.
CSS property: -webkit-margin-collapse
Description
Specifies the behavior of an element’s vertical margins if it is adjacent to an element with a margin. Elements can maintain their respective margins or share a single margin between them.
This property allows you to emulate the behavior of some browsers in quirks mode where table cell margins are collapsed into the borders of vertically adjacent cells.
See -webkit-margin-bottom-collapse and -webkit-margin-top-collapse.
Syntax
-webkit-margin-collapse: <collapse_behavior>;
Values
- <collapse_behavior>
The behavior of the vertical margins.
CSS property: -webkit-margin-start
Description
Provides the width of the starting margin.
If the writing direction is left-to-right, this value overrides margin-left. If the writing direction is right-to-left, this value overrides margin-right.
Syntax
-webkit-margin-start: <width>;
Values
- auto (by default)
The margin is automatically determined.
- <width>
The width of the starting margin. Number as a percentage, length unit.
CSS property: -webkit-margin-top-collapse
Description
Specifies the behavior of an element’s top margin if it is adjacent to an element with a margin. Elements can maintain their respective margins or share a single margin between them.
This property allows you to emulate the behavior of some browsers in quirks mode where table cell margins are collapsed into the borders of vertically adjacent cells.
Syntax
-webkit-margin-top-collapse: collapse | discard | separate;
Values
- collapse
Two adjacent margins are collapsed into a single margin.
- discard
The element’s margin is discarded if it is adjacent to another element with a margin.
- separate
Two adjacent margins remain separate.
CSS property: -webkit-marquee-direction
Description
Specifies the direction of motion for a marquee box.
Syntax
-webkit-marquee-direction: ahead | auto | backwards | down | forwards | left | reverse | right | up;
Values
- ahead
The marquee moves from bottom to top.
- auto (by default)
The marquee moves in the default direction.
- backwards
The marquee moves from right to left.
- down
The marquee moves from bottom to top.
- forwards
The marquee moves from left to right.
- left
The marquee moves from right to left.
- reverse
The marquee moves from top to bottom.
- right
The marquee moves from left to right.
- up
The marquee moves from bottom to top.
CSS property: -webkit-marquee
Syntax
-webkit-marquee: <direction> <increment> <repetition> <style> <speed>;
Values
- <direction>
The direction of the marquee.
- <increment>
The distance the marquee moves in each increment.
- <repetition>
The number of times the marquee repeats.
- <style>
The style of the marquee’s motion.
- <speed>
The scroll or slide speed of the marquee.
CSS property: -webkit-marquee-increment
Description
Defines the distance the marquee moves in each increment.
Syntax
-webkit-marquee-increment: large | medium | small | <distance>;
Values
- large
The marquee moves a large amount in each increment.
- medium
The marquee moves a medium amount in each increment.
- small
The marquee moves a small amount in each increment.
- <distance>
Number as a percentage, length unit.
CSS property: -webkit-marquee-repetition
Description
Specifies the number of times a marquee box repeats (or infinite).
Syntax
-webkit-marquee-repetition: infinite | <iterations>;
Values
- infinite (by default)
The marquee repeats infinitely.
- <iterations>
The number of times the marquee repeats. Integer, nonnegative value.
CSS property: -webkit-marquee-speed
Description
Defines the scroll or slide speed of a marquee box.
This property can either take one speed parameter (slow
, for example) or a measure of distance and a measure of time separated by a slash (/
).
Syntax
-webkit-marquee-speed: fast | normal | slow;
-webkit-marquee-speed: <distance> / <time>;
Values
- fast
The marquee moves at a fast speed.
- normal (by default)
The marquee moves at a normal speed.
- slow
The marquee moves at a slow speed.
- <distance>
Integer, nonnegative value.
- <time>
Time unit, nonnegative value.
CSS property: -webkit-marquee-style
Description
Specifies the style of marquee motion.
The values scroll
and slide
both cause the content to start outside the box and move into the box, but if the value scroll
is specified, the content stops moving once the last content is visible. The value alternate
causes the content to shift back and forth within the box in the specified direction.
Syntax
-webkit-marquee-style: alternate | none | scroll | slide;
Values
- alternate
The marquee shifts back and forth.
- none
The marquee does not move.
- scroll
The marquee loops in its specified direction.
- slide
The marquee moves in its specified direction, but stops either when the entirety of its content has been displayed or the content reaches the opposite border of its box, whichever comes second.
CSS property: -webkit-mask-attachment
Description
Defines the scrolling or fixed nature of the image mask.
Syntax
-webkit-mask-attachment: fixed | scroll;
Values
- fixed
The mask does not move when the page scrolls.
- scroll
The image moves when the page scrolls.
CSS property: -webkit-mask-box-image
Description
Defines an image to be used as a mask for a border box.
The uri
field contains the URI for the image. The four inset values that follow represent distances from the top, right, bottom, and left edges of the image. If no unit is specified, they represent actual pixels in the original image (assuming a raster image). If a unit (such as px
) is specified, they represent CSS units (which may or may not be the same thing). The values may also be specified as a percentage of the size of the image.
You can specify a repeat style in each direction. These values affect how the top, bottom, left, right, and center portions are altered to fit the required dimensions, and can be any of the following: repeat
(tiled), stretch
, or round
(the round style is like tiling, except that it stretches all nine pieces slightly so that there is no partial tile at the end).
Syntax
-webkit-mask-box-image: <uri> <top> <right> <bottom> <left> <x_repeat> <y_repeat>;
Values
- <uri>
The file path of the image.
- <top>
The distance from the top edge of the image.
- <right>
The distance from the right edge of the image.
- <bottom>
TThe distance from the bottom edge of the image.
- <left>
The distance from the left edge of the image.
- <x_repeat>
The horizontal repeat style.
- <y_repeat>
The vertical repeat style.
CSS property: -webkit-mask-clip
Description
Specifies whether the mask should extend into the border of a box.
Syntax
-webkit-mask-clip: <behavior>;
Values
- <behavior>
The clipping behavior of the mask.
CSS property: -webkit-mask-composite
Description
Sets a compositing style for a mask.
The default value is border, which means that the background extends into the border area. Specifying a value of padding limits the background so that it extends only into the padding area enclosed by the border.
Syntax
-webkit-mask-composite: border | padding;
Values
- border (by default)
The background extends into the border area.
- padding
The background extends only into the padding area enclosed by the border.
CSS property: -webkit-mask
Description
Defines a variety of mask properties within one declaration.
As with most composite properties, all arguments are optional.
Syntax
-webkit-mask: <attachment>, <clip>, <origin>, <image>, <repeat>, <composite>, <box_image>;
CSS property: -webkit-mask-image
Description
Defines an image to be used as a mask for an element.
Syntax
-webkit-mask-image: <uri>;
Values
- <uri>
The file path of the image.
CSS property: -webkit-mask-origin
Description
Determines where the -webkit-mask-position property is anchored.
Syntax
-webkit-mask-origin: border | content | padding;
Values
- border
The mask's position is anchored at the upper-left corner of the element's border.
- content
The mask's position is anchored at the upper-left corner of the element's content.
- padding
The mask's position is anchored at the upper-left corner of the element's padding.
CSS property: -webkit-mask-position
Description
Defines the position of a mask.
Position can be specified in terms of pixels or percentages of the viewport width or using the keywords top, left, center
, right, or bottom.
Changes to this property can be animated in Safari 4.0 and later.
Syntax
-webkit-mask-position: <xpos>;
-webkit-mask-position: <xpos> <ypos>;
Values
- <xpos>
The x-coordinate of the position of the mask.
- <ypos>
The y-coordinate of the position of the mask.
CSS property: -webkit-mask-position-x
Description
Defines the x-coordinate of the position of a mask.
Syntax
-webkit-mask-position-x: <xpos>;
Values
- <xpos>
The x-coordinate of the position of the mask.
CSS property: -webkit-mask-position-y
Description
Defines the y-coordinate of the position of a mask.
Syntax
-webkit-mask-position-y: <ypos>;
Values
- <ypos>
The y-coordinate of the position of the mask.
CSS property: -webkit-mask-repeat
Description
Defines the repeating qualities of a mask.
This property controls whether tiling of an element's mask should occur in the x direction, the y direction, both, or neither.
Syntax
-webkit-mask-repeat: <behavior>;
Values
- <behavior>
The repeating behavior of the mask.
CSS property: -webkit-mask-size
Description
Overrides the size of a mask.
Changes to this property can be animated in Safari 4.0 and later.
Syntax
-webkit-mask-size: <length>;
-webkit-mask-size: <length_x> <length_y>;
Values
- <length>
The width and height of the mask.
- <length_x>
The width of the mask.
- <length_y>
The height of the mask.
CSS property: -webkit-nbsp-mode
Description
Defines the behavior of nonbreaking spaces within text.
Syntax
-webkit-nbsp-mode: normal | space;
Values
- normal (by default)
Nonbreaking spaces are treated as usual.
- space
Nonbreaking spaces are treated like standard spaces.
CSS property: -webkit-padding-start
Description
Provides the width of the starting padding.
If the writing direction is left-to-right, this value overrides padding-left. If the writing direction is right-to-left, this value overrides padding-right.
Syntax
-webkit-padding-start: <width>;
Values
- <width>
The width of the starting padding.
CSS property: -webkit-perspective
Description
Gives depth to a scene, causing elements farther away from the viewer to appear smaller.
The -webkit-perspective property applies the same transform as the perspective(<number>)
transform function, except that it applies only to the children of the element, not to the transform on the element itself.
The use of this property with any value other than none
establishes a stacking context. It also establishes a containing block (somewhat similar to position:relative
), just as the -webkit-transform property does.
This transform alters the effect of other transforms. In the absence of additional transforms, this transform has no effect.
Syntax
-webkit-perspective: none | <distance>;
Values
- none (by default)
No perspective transform is applied.
- <distance>
Length in pixel. The distance in pixels from the viewer’s position to the z=0
plane.
CSS property: -webkit-perspective-origin
Description
Sets the origin of the -webkit-perspective property.
Sets the origin of the -webkit-perspective property described in "-webkit-perspective."
This property effectively sets the x and y position at which the viewer appears to be looking at the children of the element. The default value is 50%
for both x and y coordinates.
Syntax
-webkit-perspective-origin: <posx> <posy>;
Values
- <posx>
-
The x-origin as a percentage or value.
50% (by default) |
The default value is 50% . |
center |
Sets the x or y origin to the center of the element’s border box. If this constant appears before left or right, specifies the y-origin. If it appears after top or bottom, specifies the x-origin. If appears alone, centers both the x and y origin. |
left |
Sets the x-origin to the left side of the border box. |
right |
Sets the x-origin to the right side of the border box. |
- <posy>
-
The y-origin as a percentage or value.
50% (by default) |
The default value is 50% . |
center |
Sets the x or y origin to the center of the element’s border box. If this constant appears before left or right, specifies the y-origin. If it appears after top or bottom, specifies the x-origin. If appears alone, centers both the x and y origin. |
top |
Sets the y-origin to the top of the element’s border box. |
bottom |
Sets the y-origin to the bottom of the element’s border box. |
CSS property: -webkit-rtl-ordering
Description
Overrides ordering defaults for right-to-left content.
The distinction between these two character orders is normally handled automatically as a side effect of character set. This property allows you to override whether the browser should treat the content as being in logical or visual order.
Syntax
-webkit-rtl-ordering: logical | visual;
Values
- logical
Raw content is in mixed order (requiring a bidirectional renderer).
- visual
Right-to-left content is encoded in reverse order so an entire line of text can be rendered from left to right in a unidirectional fashion.
CSS property: -webkit-tap-highlight-color
Description
Overrides the highlight color shown when the user taps a link or a JavaScript clickable element in Safari on iPhone.
This property obeys the alpha value, if specified. If you don’t specify an alpha value, Safari on iPhone applies a default alpha value to the color. To disable tap highlighting, set the alpha value to 0
(invisible). If you set the alpha value to 1.0
(opaque), the element is not visible when tapped.
Syntax
-webkit-tap-highlight-color: <color>;
Values
- <color>
The tapped link color.
CSS property: -webkit-text-fill-color
Description
Specifies a fill color for text.
If not specified, the color specified by the color property is used. -webkit-fill-color
is commonly used in combination with -webkit-text-stroke. Changes to this property can be animated.
Syntax
-webkit-text-fill-color: <color>;
Values
- <color>
-
The fill color. Colors can be specified with a constant, an RGB value, or a hexadecimal value.
currentcolor |
The value of the element’s color property. |
-webkit-activelink |
The default color of a hyperlink that is being clicked. |
-webkit-focus-ring-color |
The color that surrounds a UI element, such as a text field, that has focus. |
-webkit-link |
The default color of a hyperlink that has been visited. |
-webkit-text |
The default text color. |
CSS property: -webkit-text-security
Description
Specifies the shape to use in place of letters in a password input field.
Syntax
-webkit-text-security: circle | disc | none | square;
Values
- circle
A circle shape.
- disc
A disc shape.
- none
No shape is used.
- square
A square shape.
CSS property: -webkit-text-size-adjust
Description
Specifies a size adjustment for displaying text content in Safari on iPhone.
Syntax
-webkit-text-size-adjust: none | auto | <percentage>;
Values
- none
The text size is not adjusted.
- auto
The text size is automatically adjusted for Safari on iPhone.
- <percentage>
The size in percentage at which to display text in Safari on iPhone.
Examples
The text size is automatically adjusted for Safari on iPhone:
p {
-webkit-text-size-adjust: auto;
}
The text size is not adjusted:
p {
-webkit-text-size-adjust: none;
}
The text size is adjusted at 60%:
p {
-webkit-text-size-adjust: 60%;
}
CSS property: -webkit-text-stroke-color
Description
Specifies the color of the outline (stroke) of text.
If not specified, the color specified by the color property is used. -webkit-text-stroke-color is commonly used in combination with -webkit-text-fill-color. Changes to this property can be animated.
Syntax
-webkit-text-stroke-color: <color>;
Values
- <color>
-
The color of the stroke. Colors can be specified with a constant, an RGB value, or a hexadecimal value.
currentcolor |
The value of the element's color property. |
-webkit-activelink |
The default color of a hyperlink that is being clicked. |
-webkit-focus-ring-color |
The color that surrounds a UI element, such as a text field, that has focus. |
-webkit-link |
The default color of a hyperlink that has been visited. |
-webkit-text |
The default text color. |
CSS property: -webkit-text-stroke
Syntax
-webkit-text-stroke: <width> <color>;
Values
- <width>
The width of the stroke.
- <color>
TThe color of the stroke.
CSS property: -webkit-text-stroke-width
Description
Specifies the width for the text outline.
This property is significant only in combination with -webkit-text-stroke-color.
Syntax
-webkit-text-stroke-width: medium | thick | thin | <width>;
Values
- medium
A medium stroke.
- thick
A thick stroke.
- thin
A thin stroke.
- <width>
Length unit. The width of the stroke.
CSS property: -webkit-touch-callout
Description
Disables the default callout shown when you touch and hold a touch target.
On iPhone OS, when you touch and hold a touch target such as a link, Safari displays a callout containing information about the link. This property allows you to disable that callout.
The current allowable values are none
and inherit
.
Syntax
-webkit-touch-callout: <behavior>;
Values
- <behavior>
-
The touch callout behavior.
CSS property: -webkit-transform
Description
Specifies transformations to be applied to an element.
The -webkit-transform property specifies a list of transformations, separated by whitespace, to be applied to an element, such as rotation, scaling, and so on.
The set of transform functions is similar to those allowed by SVG, although there are additional functions to support 3D transformations. If multiple transforms are applied, the transform is generated by performing a matrix concatenation of each transform in the list.
Syntax
-webkit-transform: <function> ... ;
Examples
p {
-webkit-transform: rotate(45deg);
}
CSS property: -webkit-transform-origin
Description
Sets the origin for the -webkit-transform property.
The -webkit-transform-origin property establishes the origin for transforms applied to an element with respect to its border box.
The values may be expressed either as a CSS length unit or as a percentage of the element’s size. For example, a value of 50% 50%
causes transformations to occur around the element’s center. Changing the origin to 100% 0%
causes transformation to occur around the top-right corner of the element. The default value is 50% 50%
.
If only one argument is provided, it is interpreted as the horizontal position.
Syntax
-webkit-transform-origin: posx;
-webkit-transform-origin: posx posy;
Values
- <posx>
The x origin as a percentage or value.
- <posy>
The y origin as a percentage or value.
CSS property: -webkit-transform-origin-x
Description
The x coordinate of the origin for transforms applied to an element with respect to its border box.
Syntax
-webkit-transform-origin-x: <posx>;
Values
- <posx>
The x origin as a percentage or value.
CSS property: -webkit-transform-origin-y
Description
The y coordinate of the origin for transforms applied to an element with respect to its border box.
Syntax
-webkit-transform-origin-y: <posy>;
Values
- <posy>
The y origin as a percentage or value.
CSS property: -webkit-transform-origin-z
Description
The z coordinate of the origin for transforms applied to an element with respect to its border box.
Syntax
-webkit-transform-origin-z: <posz>;
Values
- <posz>
The z origin as a percentage or value.
CSS property: -webkit-transform-style
Description
Defines how nested, transformed elements are rendered in 3D space.
If -webkit-transform-style is flat
, all children of this element are rendered flattened into the 2D plane of the element. Therefore, rotating the element about the x or y axes causes children positioned at positive or negative z positions to appear on the element’s plane, rather than in front of or behind it. If -webkit-transform-style is preserve-3d
, this flattening is not performed, so children maintain their position in 3D space.
This flattening takes place at each element, so preserving a hierarchy of elements in 3D space requires that each ancestor in the hierarchy have the value preserve-3d
for -webkit-transform-style. But -webkit-transform-style affects only an element’s children; the leaf nodes in a hierarchy do not require the preserve-3d
style.
Syntax
-webkit-transform-style: flat | preserve-3d;
Values
- flat (by default)
Flatten all children of this element into the 2D plane.
- preserve-3d
Preserve the 3D perspective.
CSS property: -webkit-transition-delay
Description
Defines when the transition starts.
Syntax
-webkit-transition-delay: now | <time> [, ...];
Values
- now
The transition begins immediately. Available in iPhone OS 2.0 and later.
- <time>
The time to begin executing a transition after it is applied. If 0
, the transition executes as soon as the property changes. Otherwise, the value specifies an offset from the moment the property changes, and the transition delays execution by that offset. If the value is negative, the transition executes the moment the property changes but appears to begin at the specified negative offset—that is, begins part-way through the transition. Nonzero values must specify a unit: s
for seconds, ms
for milliseconds. Negative values are invalid. The default value is 0
.
CSS property: -webkit-transition-duration
Description
Defines how long the transition from the old value to the new value should take.
Syntax
-webkit-transition-duration: <time> [, ...];
Values
- <time>
If 0
, the transition is immediate (there is no animation). A negative value is treated as 0
. Nonzero values must specify a unit: s
for seconds, ms
for milliseconds. Negative values are invalid. The default value is 0
.
CSS property: -webkit-transition
Syntax
-webkit-transition: <property> <duration> <timing_function> <delay> [, ...];
CSS property: -webkit-transition-property
Description
Specifies the name of the CSS property to which the transition is applied.
Syntax
-webkit-transition-property: none | all | <name>;
Values
- none
No transition specified.
- all (by default)
The default transition name.
- <name>
CSS property name. You can list multiple properties. Property names should be bare, unquoted names.
CSS property: -webkit-transition-timing-function
Description
Specifies how the intermediate values used during a transition are calculated.
This property allows for a transition to change speed over its duration. These effects, commonly called easing functions, are mathematical functions that produce a smooth curve.
The timing function is specified using a cubic Bezier curve. Use the constants to specify preset points of the curve or the cubic-bezier
function to specify your own points. See cubic-bezier for a description of the parameters for this function.
The timing function takes as its input the current elapsed percentage of the transition duration and outputs a percentage that determines how close the transition is to its goal state.
Syntax
-webkit-transition-timing-function: <timing_function> [, ...];
Values
- <timing_function>
-
The timing function.
ease (by default) |
Equivalent to cubic-bezier(0.25, 0.1, 0.25, 1.0)
|
linear |
Equivalent to cubic-bezier(0.0, 0.0, 1.0, 1.0)
|
ease-in |
Equivalent to cubic-bezier(0.42, 0, 1.0, 1.0)
|
ease-out |
Equivalent to cubic-bezier(0, 0, 0.58, 1.0)
|
ease-in-out |
Equivalent to cubic-bezier(0.42, 0, 0.58, 1.0)
|
CSS property: -webkit-user-drag
Description
Specifies that an entire element should be draggable instead of its contents.
Syntax
-webkit-user-drag: auto | element | none;
Values
- auto
The default dragging behavior is used.
- element
The entire element is draggable instead of its contents.
- none
The element cannot be dragged at all.
CSS property: -webkit-user-modify
Description
Determines whether a user can edit the content of an element.
This is closely related to the contentEditable
attribute.
Syntax
-webkit-user-modify: read-only | read-write | read-write-plaintext-only;
Values
- read-only
The content is read-only.
- read-write
The content can be read and written.
- read-write-plaintext-only
The content can be read and written, but any rich formatting of pasted text is lost.
CSS property: -webkit-user-select
Description
Determines whether a user can select the content of an element.
Syntax
-webkit-user-select: auto | none | text;
Values
- auto
The user can select content in the element.
- none
The user cannot select any content.
- text
The user can select text in the element.
Examples
The user can select content in the element:
p {
-webkit-user-select: auto;
}
The user cannot select any content:
p {
-webkit-user-select: none;
}
The user can select text in the element:
p {
-webkit-user-select: text;
}
« CSS « CSS Reference
Summary
The white-space
CSS property is used to to describe how whitespace inside the element is handled.
Syntax
white-space: normal | pre | nowrap | pre-wrap | pre-line |
inherit
Values
- normal
- Sequences of whitespace are collapsed. Newline characters in the source are handled as other whitespace. Breaks lines as necessary to fill line boxes.
- pre
- Sequences of whitespace are preserved, lines are only broken at newline characters in the source.
- nowrap
- Collapses whitespace as for
normal
, but suppresses line breaks (text wrapping) within text. - pre-wrap
New in Firefox 3
- Sequences of whitespace are preserved. Lines are only broken at newline characters in the source and as necessary to fill line boxes.
For backward compatibility with Firefox 2, you may wish to also include -moz-pre-wrap
, which does the same thing in older versions of Firefox but is ignored in Firefox 3.5 and later. - pre-line
New in Firefox 3.5
- Sequences of whitespace are collapsed. Lines are broken at newlines in the source and as necessary to fill line boxes.
The following table summarizes the behavior of various white-space
values:
| New lines | Spaces and tabs | Text wrapping |
normal | Collapse | Collapse | Wrap |
pre | Preserve | Preserve | No wrap |
nowrap | Collapse | Collapse | No wrap |
pre-wrap | Preserve | Preserve | Wrap |
pre-line | Preserve | Collapse | Wrap |
Examples
code { white-space: pre; }
Notes
white-space:pre-line
is not implemented in Firefox prior to version 3.5 (Gecko 1.9.1).
Browser compatibility
Browser | Lowest version | Support of |
Internet Explorer | 5.5 | normal | nowrap |
5.5 | [*] |
6.0 | normal | pre | nowrap |
8.0 | normal | pre | nowrap | pre-wrap | pre-line |
Firefox (Gecko) | 1.0 (1.0) | normal | pre | nowrap | -moz-pre-wrap |
3.0 (1.9) | normal | pre | nowrap | pre-wrap | -moz-pre-wrap |
3.5 (1.9.1) | normal | pre | nowrap | pre-wrap | pre-line |
Opera | 4.0 | normal | pre | nowrap |
8.0 | normal | pre | nowrap | pre-wrap |
9.5 | normal | pre | nowrap | pre-wrap | pre-line |
Safari (WebKit) | 1.0 (85) | normal | pre | nowrap |
3.0 (522) | normal | pre | nowrap | pre-wrap | pre-line |
[*] Internet Explorer 5.5+ supports
word-wrap
: break-word;
The following code allows line breaking inside pre
elements:
pre {
word-wrap: break-word; /* IE 5.5-7 */
white-space: -moz-pre-wrap; /* Firefox 1.0-2.0 */
white-space: pre-wrap; /* current browsers */
}
In printing, a "widow" is the last line of a paragraph appearing alone at the top of a page, such as the line seen inside the red box in the illustration below.The widows
property avoids widows by specifying the minimum number of lines of a paragraph that appear at the top of a page when a Web page is printed.
Example : p {widows: 3}
Default value will be :2
Minimum number of lines of a paragraph that must appear at the top of a page.
Inherit : Use the same computed value as the parent element for this property.
Apples to - Block level elements
Browser Compatibility
Browser | Lowest version |
Internet Explorer | IE 8 |
Firefox (Gecko) | -- |
Opera | 9.2 |
Safari | Chrome | WebKit | -- |
« CSS « CSS Reference
Summary
The width
CSS property specifies the width of the content area of an element. The content area is inside the padding, border, and margin of the element.
Syntax
width: <length> | <percentage> | auto | inherit | -moz-max-content | -moz-min-content | -moz-fit-content | -moz-available
Values
- <length>
- See
<length>
for possible units. - <percentage>
- Specified as a
<percentage>
of containing block's width. - auto
- The browser will calculate and select a width for the specified element.
Mozilla Extensions
- -moz-max-content
-
New in Firefox 3
The intrinsic preferred width.
- -moz-min-content
-
New in Firefox 3
The intrinsic minimum width.
- -moz-available
-
New in Firefox 3
The containing block width minus horizontal margin, border and padding.
- -moz-fit-content
-
New in Firefox 3
The larger of:
- the intrinsic minimum width
- the smaller of the intrinsic preferred width and the available width
Examples
View Live Examples
table { width: 100%; }
img { width: 200px; }
form { width: auto; }
p { width: 40em; }
p { background: gold }
The Mozilla community produces a lot of great software.
p { background: lightgreen;
width: intrinsic; /* Safari/WebKit */
width: -moz-max-content; /* Firefox/Gecko */
}
The Mozilla community produces a lot of great software.
p { background: lightblue; max-width: -moz-min-content; }
The Mozilla community produces a lot of great software.
Browser compatibility
Browser | Lowest Version | intrinsic width | intrinsic minimum width |
Internet Explorer | 4.0 | --- | --- | --- | --- |
Firefox (Gecko) |
1.0 (1.0) | 3.0 (1.9) | -moz-max-content -moz-fit-content | 3.0 (1.9) | -moz-min-content |
Opera | 3.5 | --- | --- | --- | --- |
Safari (WebKit) |
1.0 (85) | 2.0 (412) ? | intrinsic | --- | --- |
« CSS « CSS Reference
Summary
The word-spacing
CSS property specifies spacing behavior between words.
Syntax
word-spacing: normal | <length>
Values
- normal
- The normal inter-word space, as defined by the current font and/or the UA.
- <length>
- See
<length>
value for possible units.
Examples
p { word-spacing: 1em; }
Browser compatibility
Browser | Lowest Version |
Internet Explorer | 6.0 |
Firefox (Gecko) |
1.0 (1.0) |
Opera | 3.5 |
Safari (WebKit) |
1.0 (85) |
« CSS « CSS Reference
Introduced in Gecko 1.9.1
(Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)
Summary
The word-wrap
CSS property is used to to specify whether or not the browser is allowed to break lines within words in order to prevent overflow when an otherwise unbreakable string is too long to fit.
Syntax
word-wrap: normal | break-word
Values
- normal
- Lines may only break at normal word break points.
- break-word
- Unbreakable words may be broken at arbitrary points if there are no otherwise acceptable break points in the line.
Examples
p { width:13em; background:gold; }
FStrPrivFinÄndG (Gesetz zur Änderung des Fernstraßenbauprivatfinanzierungsgesetzes und straßenverkehrsrechtlicher Vorschriften)
p { width:13em; background:gold; word-wrap:break-word; }
FStrPrivFinÄndG (Gesetz zur Änderung des Fernstraßenbauprivatfinanzierungsgesetzes und straßenverkehrsrechtlicher Vorschriften)
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
word-wrap | 3.5 (1.9.1)
| 1.0 | 5.5 | 10.5 | 1.0 |
Feature | Firefox Mobile (Gecko) | Android | IE Mobile | Opera Mobile | Safari Mobile |
word-wrap | 1.0 (1.9.1)
| 1.0 | ? | ? | 1.0 |
-
word-wrap:break-word
can be used to work around lack of pre{white-space:pre-wrap}
support in IE 5.5-7. See
white-space
for an example. - IE8 introduced
-ms-word-wrap
as a synonym for word-wrap
. Don't use the -ms-
prefix.
« CSS « CSS Reference
The :active
pseudo-class matches when an element is being activated by the user. It allows the page to give a feedback that the activation has been detected by the browser. When interacting with a mouse, this is typically the time between the user presses the mouse button and releases it. It is often used on
<a>
and
<button>
HTML elements.
Note: on system with mice having several buttons, CSS 3 specifies that the :active
pseudo-class must only apply to the primary button, typically the left-most button on mice for right-handed.
Browser compatibility
Browser | Lowest Version |
Internet Explorer | 4.0 (only for <a> ) |
Firefox | 1.0 |
Opera | 5.0 (only for <a> ) 7.0
|
Safari | 1.0 |
« CSS « CSS Reference
Summary
:after
creates a pseudo-element that is the last child of the element matched. Typically used to add cosmetic content to an element, by using the
content
CSS property. This element is inline by default.
Firefox 3.5 note
Firefox prior to version 3.5 only implemented the CSS 2.0 version of :after
. Not allowed were position, float, list-style-*
and some display properties. Firefox 3.5 removed those restrictions. Note this is independent from the colon notation issue mentioned below.
Syntax
element:after { style properties } /* CSS2 syntax */
element::after { style properties } /* CSS3 syntax */
The ::after
notation was introduced in CSS 3 in order to establish a discrimination between pseudo-classes and pseudo-elements. Browsers also accept the notation :after
introduced in CSS 2.
Note: Microsoft Internet Explorer 8 supports the :after
notation only.
Examples
.boringtext:after {
content: " Thank you for reading all this!";
font-size: small;
color: red;
background: gray;
}
Browser compatibility
Browser | Lowest Version | Support of |
Internet Explorer | 8.0 | :after |
Firefox (Gecko) | 1.0 (1.0) | :after |
1.0 (1.5) | :after | ::after |
Opera | 4.0 | :after |
7.0 | :after | ::after |
Safari (WebKit) | 1.0 (85) | :after | ::after |
« CSS « CSS Reference
Summary
:before
creates a pseudo-element that is the first child of the element matched. Often used to add cosmetic content to an element, by using the
content
property. This element is inline by default.
Firefox 3.5 note
Firefox prior to version 3.5 only implemented the CSS 2.0 version of :before. Not allowed were position, float, list-style-* and some display properties. Firefox 3.5 removed those restrictions. (Note this is independent from the :: notation issue mentioned below.)
Syntax
element:before { style properties } /* CSS2 syntax */
element::before { style properties } /* CSS3 syntax */
The ::before
notation was introduced in CSS 3 in order to establish a discrimination between pseudo-classes and pseudo-elements. Browsers also accept the notation :before
introduced in CSS 2.
Note: Microsoft Internet Explorer 8 only supports the :before
notation.
Examples
q:before { content: "»" }
q:after { content: '«' }
<q>Some quotes</q>, he said, <q>are better than none</q>.
Result: »Some quotes«, he said, »are better than none«.
Notes
Although the positioning fixes in Firefox 3.5 do not allow content to be generated as a separate previous sibling (as per the CSS spec stating "The :before and :after pseudo-elements elements interact with other boxes... as if they were real elements inserted just inside their associated element."), they can be used to provide a slight improvement on tableless layouts (e.g., to achieve centering) in that, as long as the content to be centered is wrapped in a further child, a column before and after the content can be introduced without adding a previous or following sibling (i.e., it is perhaps more semantically correct to add an additional span as below, than it would to add an empty <div/> before and after). (And always remember to add a width to a float, since, otherwise, it will not float!)
<style type="text/css">
#floatme {float:left; width:50%;}
.example:before {
content: "Floated Before"; /* To get an empty column, just indicate a hex code for a non-breaking space: \a0 as the content (use \0000a0 when following such a space with other characters) */
float: left;
width:25%
}
.example:after {
content: "Floated After";
float: right;
width:25%
}
/* For styling */
.example:before, .example:after, .first {
background: yellow;
color: red;
}
</style>
<div class="example">
<span id="floatme">"Floated Before" should be generated on the left of the
viewport and not allow overflow in this line to flow under it. Likewise
should "Floated After" appear on the right of the viewport and not allow this
line to flow under it.</span>
</div>
Browser compatibility
Browser | Lowest Version | Support of |
Internet Explorer | 8.0 | :before |
Firefox (Gecko) | 1.0 (1.0) | :before |
1.0 (1.5) | :before | ::before |
Safari (WebKit) |
1.0 (85) | :before | ::before |
Opera | 4.0 | :before |
7.0 | :before | ::before |
Summary
The @charset
CSS at-rule specifies the character encoding used in the style sheet. It must be the first element in the style sheet and not be preceded by any character. If several @charset
at-rules are defined, only the first one is used, and it cannot be used inside a style
attribute on an HTML element or inside the
<style>
element where the character set of the HTML page is relevant.
This at-rule is useful when using non-ASCII characters in some CSS properties, like
content
.
As there are several ways to define the character encoding of a style sheet, the browser will try the following methods in the following order (and stop as soon as one yields a result) :
- The value given by the
charset
attribute of the Content-Type:
HTTP header or the equivalent in the protocol used to serve the style sheet. - The value of the Unicode byte-order character placed at the beginning of the file.
- The
@charset
CSS at-rule. - Use the character encoding defined by the referring document: the
charset
attribute of the
<link>
element. This method is obsoleted in HTML5 and must not be used. - Assume that the document is UTF-8.
Syntax
@charset charset
where :
- charset
- Is a
<string>
denoting the character encoding to be used. It must be the name of a web-safe character encoding defined in the IANA-registry. If several names are associated with an encoding, only the one marked with preferred must be used.
Examples
@charset "UTF-8" // Set the encoding of the style sheet to Unicode UTF-8
@charset 'iso-8859-15' // Set the encoding of the style sheet to Latin-9 (Western European languages, with euro sign)
@charset "UTF-8" // Invalid, there is a character before the at-rule
@charset UTF-8 // Invalid, without ' or ", the charset is not a CSS <string>
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | 2.0 | 1.5 (1.8)
[*] | 5.5 [**] [1]
| 9 | 4 |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | 2.1 | 1.0 (1.8)
| 5.5 [**] [2]
| 10.0 | 4 |
[*] Firefox 1.0 supported only an invalid syntax where the character encoding is not set between single or double quotes.
[**] From IE 5.5 to IE 7 included, IE also supported the invalid syntax where the character encoding is not set between single or double quotes.
« CSS « CSS Reference
Summary
The :checked
pseudo-class selector represents any radio (<input type="radio">
) or checkbox (
<option>
in a
<select>
) element that is checked or toggled to an on
state. The user can change this state by clicking on the element, or selecting a different value, in which case the :checked
pseudo-class no longer applies to this element, but will to the relevant one.
Syntax
element:checked { style properties }
Examples
Example selectors
-
input[type="radio"]:checked
- Represents all radio buttons on the page that are checked
- input[type="checkbox"]:checked
- Represents all checkboxes on the page that are checked
Specifications
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | ? | 1.0 (1.7 or earlier)
| 9 | 9.0 | ? |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
This content covers features introduced in Firefox 3.
Summary
The :default
pseudo-class represents any user interface element that is the default among a group of similar elements.
For example, the default button in a set of buttons could be selected using this pseudo-class.
User interface elements that permit multiple selections may have multiple defaults set in order to initially appear with multiple items selected. In that case all defaults can be represented using the :default
pseudo-class.
Syntax
:default { style properties }
Examples
:default
{
background-color: lime;
}
...where...
<form method="get">
<p><input type="submit" id="submit1"></p>
<p><input type="submit" id="submit2"></p>
<p><input type="reset"></p>
</form>
This example causes the background color to be lime
for the default submit button in the form.
« CSS « CSS Reference
Summary
The :disabled
pseudo-class represents any disabled element. An element is disabled if it can't be activated (e.g. selected, clicked on or accept text input) or accept focus. The element also has an enabled state, in which it can be activated or accept focus.
Examples
Example selectors
- input:disabled
- Selects all disabled inputs
- select.country:disabled
- Targets a select element with class country that is disabled
Usage example
The following CSS:
.input[type="text"]:disabled {background:#ccc}
applied to this HTML5 fragment:
<form action="#">
<fieldset>
<legend>Shipping address</legend>
<input type="text" name="shipping_firstName" disabled>
<input type="text" name="shipping_lastName" disabled>
<input type="text" name="shipping_address1" disabled>
<input type="text" name="shipping_address2" disabled>
<input type="text" name="shipping_zipCode" disabled>
<input type="text" name="shipping_town" disabled>
</fieldset>
<fieldset>
<legend>Billing address</legend>
<label>
<input type="checkbox" name="billing_is_shipping" value="true" checked>
Billing address is the same as shipping address
</label>
<input type="text" name="billing_firstName" disabled>
<input type="text" name="billing_lastName" disabled>
<input type="text" name="billing_address1" disabled>
<input type="text" name="billing_address2" disabled>
<input type="text" name="billing_zipCode" disabled>
<input type="text" name="billing_town" disabled>
</fieldset>
</form>
Will result in all text elements in the billing fieldset having a light grey background.
Specifications
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | ? | 1.0 (1.7 or earlier)
| 9 | 9.0 | ? |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The :empty
pseudo-class represents any element that has no children at all. Only element nodes and text (including whitespace) are considered. Comments or processing instructions do not affect whether an element is considered empty or not.
Syntax
span:empty { style properties }
Examples
span:empty::before { background-color: lime; }
...where...
<span></span>
Browser compatibility
Browser | Lowest Version |
Internet Explorer | --- |
Firefox (Gecko) |
1.5 (1.8) |
Opera | 9.5 |
Safari (WebKit) |
3.1 (525), very buggy before |
« CSS « CSS Reference
Browser compatibility
Browser | Lowest Version |
Internet Explorer | ? |
Firefox | ? |
Opera | ? |
Safari | ? |
« CSS « CSS Reference
Summary
The :first-child
pseudo-class represents any element that is the first child element of its parent.
Syntax
element:first-child { style properties }
Examples
span:first-child
{
background-color: lime;
}
...where...
<div>
<span>This span is limed!</span>
<span>This span is not. :(</span>
</div>
... should look like ...
This span is limed! This span is not. :(
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | 4.0 | 3.0 (1.9)
| 7 | 9.5 | 4 |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | 1.0 | 1.0 (1.9.1)
| 7 | 10.0 | 3.1 |
Notes
- In Internet Explorer 8, if a element is inserted dynamically by clicking on a link the first-child style isn't applied until the link loses focus.
« CSS « CSS Reference
Summary
The :first
page pseudo-class describes the styling of the first page when printing a document.
Note: you can not change all CSS properties. You can only change the margins, orphans, widows, and page breaks of the document. All other CSS properties will be ignored.
Examples
@page :first {
margin:2in 3in;
}
Note: you may only use the absolute length units when defining the margin. Please see the page about
length for more information.
Browser compatibility
Browser | Lowest Version |
Internet Explorer |
8.0 |
Firefox (Gecko) | --- |
Opera |
9.2 |
Safari (WebKit) | --- |
« CSS « CSS Reference
Introduced in Gecko 1.9.1
(Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)
Summary
The :first-of-type
pseudo-class represents the first sibling of the given type in the list of children of its parent element.
Syntax
element:first-of-type { style properties }
Example
To match the first data cell in a table row, you can use this:
tr > td:first-of-type
« CSS « CSS Reference
Browser compatibility
Browser | Lowest Version |
Internet Explorer | 8.0 |
Firefox | 1.0 |
Opera | 7.0 |
Safari | (1.0 ?) |
Summary
@font-face
allows authors to specify online fonts to display text on their web pages. By allowing authors to provide their own fonts, @font-face
eliminates the need to depend on the limited number of fonts users have installed on their computers.
Syntax
@font-face {
font-family: <a-remote-font-name>;
src: <source> [,<source>]*;
[font-weight: <weight>];
[font-style: <style>];
}
Values
- <a-remote-font-name>
- Specifies a font name that will be used as font face value for font properties.
- <source>
- URL for the remote font file location, or the name of a font on the user's computer in the form
local("Font Name")
. - <weight>
- A font weight value.
- <style>
- A font style value.
You can specify a font on the user's local computer by name using the local()
syntax. If that font isn't found, other sources will be tried until one is found.
Examples
This example simply specifies a downloadable font to use, applying it to the entire body of the document.
View live sample
<html>
<head>
<title>Web Font Sample</title>
<style type="text/css" media="screen, print">
@font-face {
font-family: "Bitstream Vera Serif Bold";
src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");
}
body { font-family: "Bitstream Vera Serif Bold", serif }
</style>
</head>
<body>
This is Bitstream Vera Serif Bold.
</body>
</html>
In this example, the user's local copy of "Helvetica Neue Bold" is used; if the user doesn't have that font installed (two different names are tried), then the downloadable font named "MgOpenModernaBold.ttf" is used instead:
@font-face {
font-family: MyHelvetica;
src: local("Helvetica Neue Bold"),
local("HelveticaNeue-Bold"),
url(MgOpenModernaBold.ttf);
font-weight: bold;
}
Notes
- In Gecko, web fonts are subject to the same domain restriction (font files must be on the same domain as the page using them), unless HTTP access controls are used to relax this restriction.
-
Note: Because there are no defined MIME types for TrueType, OpenType, and WOFF fonts, the MIME type of the file specified is not considered.
- When Gecko displays a page that uses web fonts, it initially displays text using the best CSS fallback font available on the user's computer while it waits for the web font to finish downloading. As each web font finishes downloading, Gecko updates the text that uses that font. This allows the user to read the text on the page more quickly.
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 3.5 (1.9.1)
| 4.0 | 4.0 | 10.0 | 3.1 |
WOFF | 3.5 (1.9.1)
| 6.0 | 9.0 |
Nightly build
|
Nightly build
|
SVG Font |
-- Unimplemented (see
bug 119490
)
| yes | -- | yes | yes |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mini | Opera Mobile | Safari Mobile |
Basic support | (Supported) | 1.0 (1.9.1)
| ? | -- | 10.0 | (Supported) |
WOFF | -- | 5.0 (5.0)
| ? | -- | 11.0 | -- |
SVG fonts | -- |
-- Unimplemented (see
bug 119490
)
| ? | -- | 10.0 | (Supported) |
Notes
- Support of the Embedded OpenType font format is not included in the compatibility table because it is a proprietary feature. Prior to IE 9.0, IE supported only this format.
- TrueType and OpenType are not included because they are superseded by WOFF.
See also
- CSS Reference
- CSS at-rules: @charset, @font-face, @import, @keyframes, @media, @page.
-
font
,
font-family
,
font-size
,
font-size-adjust
,
font-stretch
,
font-style
,
font-variant
,
font-weight
,
@font-face
- FontSquirrel @font-face generator
- About WOFF
- Beautiful fonts with @font-face
- Open Font Library
- MSDN Microsoft library @font-face
-
When can I use WOFF?When can I use SVG Fonts?
« CSS « CSS Reference
Summary
The :hover
CSS pseudo-class matches when the user designates an element with a pointing device, but does not necessarily activate it.
Visual user agents, like Firefox, Internet Explorer, Safari, Opera or Chrome, apply the associated style when the cursor (mouse pointer) hovers over an element.
Usage Note : on touch screens there are no hover possible. The :hover
pseudo-class never matches. As touchscreen devices are very common, it is important for web developer not to have content accessible only when hovering over it, as this content would be hidden for users of such devices.
Examples
:link:hover { outline: dotted red; }
.foo:hover { background: gold; }
Browser compatibility
Browser | Lowest Version |
Internet Explorer | 4.0 (only for <a> ) |
7.0 |
Firefox (Gecko) |
1.0 (1.0) |
Opera | 4.0 (only for <a> ) |
7.0 |
Safari (WebKit) |
2.0.4 (419) various bugs before
|
Summary
The @import
CSS at-rule allows to import style rules from other style sheets. These rules must precede all other types of rules, except
@charset
rules.
So that user agents can avoid retrieving resources for unsupported media types, authors may specify media-dependent @import
rules. These conditional imports specify comma-separated media queries after the URI. In the absence of any media query, the import is unconditional. Specifying all
for the medium has the same effect.
Syntax
@import url; or
@import url list-of-media-queries;
where :
- url
- Is a
<string>
or a
<uri>
representing the location of the resource to import. The url may be an absolute or relative url. - list-of-media-queries
- Is a comma-separated list of media queries conditioning the application of the css rules defined in the linked url. If the browser doesn't support any of these media types, it won't even load the linked resource.
Examples
@import url("fineprint.css") print;
@import url("bluish.css") projection, tv;
@import 'custom.css';
@import "common.css" screen, projection;
@import url('landscape.css') screen and (orientation:landscape);
Specifications
Specification | Status | Comment |
Media Queries | Candidate Recommandation
| Extended the syntax to support any media query and not only simple media types. |
CSS Level 2 (Revision 1) | Recommendation
| Added support for
<string> to denote the url of a stylesheet, and requirement to insert the @import rule at the beginning of the CSS document. |
CSS Level 1 | Recommendation
| |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | (Supported) | (Supported) | 5.5 [1]
| (Supported) | (Supported) |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | (Supported) | (Supported) | 5.5 [2]
| (Supported) | (Supported) |
« CSS « CSS Reference
Summary
The :indeterminate
CSS pseudo-class represents any <input type="checkbox">
element whose indeterminate
DOM property is set to true
by JavaScript. In addition, in some browsers, it can be used to match to
<progress>
elements in an indeterminate state.
Examples
W3C CSS3 Selectors test#177
<style>
input, span { background: red }
:indeterminate, :indeterminate + span { background: limegreen }
</style>
<p><input type=checkbox> <span>Everything in this paragraph should have a green background.</span></p>
<script> document.getElementsByTagName("input")[0].indeterminate = true; </script>
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Checkboxes | (Supported) | 3.6 (1.9.2)
| 9.0 | 10.60 (2.6) | 3.0 |
<progress>
| ? | 6.0 (6.0)
| ? | ? | ? |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Checkboxes | ? | 1.0 (1.9.2)
| ? | ? | ? |
<progress>
| ? | 6.0 (6.0)
| ? | ? | ? |
« CSS « CSS Reference
Introduced in Gecko 2.0
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Summary
The :invalid
pseudo-class represents any
<input>
element whose content fails to validate according to the input's type setting. This allows you to easily have invalid fields adopt an appearance that helps the user identify and correct errors.
By default, Gecko does not apply a style to the :invalid
pseudo-class. However it does apply a style (a red "glow" using the
box-shadow
property) to the
:-moz-ui-invalid
pseudo-class, which applies in a subset of cases for :invalid
.
You can disable the glow using the following CSS, or completely override it to alter the appearance of invalid fields.
:invalid {
box-shadow: none;
}
:-moz-submit-invalid {
box-shadow: none;
}
:-moz-ui-invalid {
box-shadow:none;
}
Notes
Radio buttons
If any of the radio buttons in a group (that is, with the same value for their name
attribute) is required
, the :invalid
pseudo-class is applied to all of them if none of the buttons in the group are selected.
Examples
This example presents a simple form that colors elements green when they validate and red when they don't.
<style type="text/css">
:invalid {
background-color: #ffdddd;
}
:valid {
background-color: #ddffdd;
}
:required {
border-color: #800000;
border-width: 3px;
}
</style>
<form>
<label>Enter a URL:</label>
<input type="url" />
<br />
<br />
<label>Enter an email address:</label>
<input type="email" required/>
</form>
View this sample live.
Browser compatibility
Browser | Lowest version |
Internet Explorer | --- |
Firefox (Gecko) | 4.0 (2.0) |
Opera | 9.5 |
Safari | Chrome | WebKit | 5 | 8 | 534.10 |
Summary
@keyframes
lets authors control the intermediate steps in a CSS animation sequence by establishing keyframes (or waypoints) along the animation sequence that must be reached by certain points during the animation. This gives you more specific control over the intermediate steps of the animation sequence than you get when letting the browser handle everything automatically.
To use keyframes, you create a @keyframes
rule with a name that is then used by the
animation-name
property to match an animation to its keyframe list. Each @keyframes
rule contains a style list of keyframe selectors, each of which is comprised of a percentage along the animation at which the keyframe occurs as well as a block containing the style information for that keyframe.
You can list the keyframes in any order; they will be handled in the order in which their specified percentages indicate they should occur.
Valid keyframe lists
In order for a keyframe list to be valid, it must include rules for at least the times 0% (or from
) and 100% (or to
) (that is, the starting and ending states of the animation). If both of these time offsets aren't specified, the keyframe declaration is invalid and can't be used for animation.
If you include properties that can't be animated in your keyframe rules, they get ignored, but the supported properties will still be animated.
Duplicate resolution
If multiple keyframe sets exist for a given name, the last one encountered is used. @keyframes
rules don't cascade, so animations never drive keyframes from more than one rule set.
If a given animation time offset is duplicated, the last keyframe in the @keyframes
rule for that percentage is used for that frame. There's no cascading within a @keyframes
rule if multiple keyframes specify the same percentage values.
When properties are left out of some keyframes
Any properties that you don't specify in every keyframe are interpolated (with the exception of those that can't be interpolated, which are instead dropped from the animation entirely). For example:
@keyframes identifier {
0% { top: 0; left: 0; }
30% { top: 50px; }
68%, 72% { left: 50px; }
100% { top: 100px; left: 100%; }
}
Here, the
top
property animates using the 0%, 30%, and 100% keyframes, and
left
animates using the 0%, 70%, and 100% keyframes.
Only properties that are specified in both the 0% and 100% keyframes will be animated; any property not included in both of those keyframes will retain their starting value for the duration of the animation sequence.
Syntax
@keyframes <identifier> {
[ [ from | to | <percentage> ] [, from | to | <percentage> ]* block ]*
}
Values
<identifier>
- A name identifying the keyframe list. This must match the identifier production in CSS syntax.
from
- A starting offset of 0%.
to
- An ending offset of 100%.
-
<percentage>
- A percentage of the time through the animation sequence at which the specified keyframe should occur.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support |
(Supported)
-webkit
| 5.0 (5.0)
-moz
| 10
-ms [1]
| ? | 4.0
-webkit
|
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
See also
- CSS animations
- CSS Reference
- CSS at-rules: @charset, @font-face, @import, @keyframes, @media, @page.
-
AnimationEvent
-
animation
,
animation-delay
,
animation-direction
,
animation-duration
,
animation-fill-mode
,
animation-iteration-count
,
animation-name
,
animation-play-state
,
animation-timing-function
,
@keyframes
« CSS « CSS Reference
Summary
The :lang(language-code
pseudo-class matches elements based on the langauge the element is determined to be in. In HTML, the language is determined by a combination of the lang
attribute, the
<meta>
element, and possibly by information from the protocol (such as HTTP headers). For other document types there may be other document methods for determining the language.
Acceptable language-code
strings are specified in in HTML 4.0 specification.
Syntax
element:lang(language-code) { style properties }
Examples
In this example, the lang
selector is used to match on the parent of a quote element using child selectors. Its not meant to demonstrate the only way to do this, or even the correct way (which would depend on the type of document). Note, Unicode values are used to specify special quote characters.
:lang(en) > Q { quotes: '\201C' '\201D' '\2018' '\2019'; }
:lang(fr) > Q { quotes: '« ' ' »'; }
:lang(de) > Q { quotes: '»' '«' '\2039' '\203A'; }
...where...
<div lang="fr"><q>This French quote has a <q>nested</q> quote.</q></div>
<div lang="de"><q>This German quote has a <q>nested</q> quote.</q></div>
<div lang="en"><q>This English quote has a <q>nested</q> quote.</q></div>
... should look like ...
«This French quote has a «nested» quote.»
»This German quote has a ‹nested› quote.«
“This English quote has a ‘nested’ quote.”
Browser compatibility
Browser | lowest version |
Internet Explorer | 8.0 |
Firefox (Gecko) | 1.0 (1.2) |
Opera | 8.0 |
Safari (WebKit) | 3.1 (525) |
« CSS « CSS Reference
Summary
The :last-child
pseudo-class represents any element that is the last child element of its parent.
Syntax
element:last-child { style properties }
Examples
span:last-child
{
background-color: lime;
}
...where...
<div>
<span>This span is not limed.</span>
<span>This span is! :)</span>
</div>
... should look like ...
This span is not limed. This span is! :)
« CSS « CSS Reference
Introduced in Gecko 1.9.1
(Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)
Summary
The :last-of-type
pseudo-class represents the last sibling of the given type in the list of children of its parent element.
Syntax
element:last-of-type { style properties }
Example
To match the last data cell in a table row, you can use this:
tr > td:last-of-type
« CSS « CSS Reference
Summary
The :left
page pseudo-class matches any left page when printing a page. It allows to describe the styling of left-side pages.
Whether the page is left or right is decided by the major writing direction of the document. For example, if the first page has a major writing direction of left-to-right then it will be a :right
page and if it has a major writing direction of right-to-left then it will be a :left
page.
Note: You can't change all CSS properties. You can only change the the margin, padding, border, and background properties of the page box. All other CSS properties will be ignored, and only the page box, not the document content on the page, will be affected.
Examples
@page :left {
margin:2in 3in;
}
Browser compatibility
Feature | Gecko | Webkit | Internet Explorer | Opera |
Basic support | -- | ? | 8 | 9.2 |
« CSS « CSS Reference
Summary
The :link
pseudo-class lets you select only links that have not yet been visited.
Examples
a:link {color:slaygrate;}
.external:link {background-color:lightblue;}
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | 1 | 1.0 (1.7 or earlier)
| 3.0 | 3.5 | 1.0 |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | 1.5 | 1.0 (1.9.2)
| ? | ? | 3.2 |
Summary
@media
specifies the target media types (separated by commas) of a set of rules (delimited by curly braces).
Syntax
@media <media types> {
/* media-specific rules */
}
Media types
Note: Firefox currently only implements the
print
and
screen
media types. The
FullerScreen extension enables support for the
projection
media type.
- all
- Suitable for all devices.
- braille
- Intended for braille tactile feedback devices.
- embossed
- Intended for paged braille printers.
- handheld
- Intended for handheld devices (typically small screen, limited bandwidth).
- print
- Intended for paged material and for documents viewed on screen in print preview mode. Please consult the section on paged media, and the media section of the Getting Started tutorial for information about formatting issues that are specific to paged media.
- projection
- Intended for projected presentations, for example projectors. Please consult the section on paged media for information about formatting issues that are specific to paged media.
- screen
- Intended primarily for color computer screens.
- speech
- Intended for speech synthesizers. Note: CSS2 had a similar media type called 'aural' for this purpose. See the appendix on aural style sheets for details.
- tty
- Intended for media using a fixed-pitch character grid (such as teletypes, terminals, or portable devices with limited display capabilities). Authors should not use pixel units with the "tty" media type.
- tv
- Intended for television-type devices (low resolution, color, limited-scrollability screens, sound available).
Media groups
Media types are also part of different Media Groups. The following table indicates which types are in which group.
|
X | | | | | X | X | | X | X |
| X | | | | X | X | | | X |
X | X | X | X | X | | X | X | X | X |
| X | X | | | | | X | | X |
| X | X | | | | | X | X | |
X | | X | X | | | | X | X | X |
X | | | | X | | | | X | X |
X | | X | | | | X | | X | X |
X | X | X | X | | | | X | X | X |
Examples
@media print {
body { font-size: 10pt }
}
@media screen {
body { font-size: 13px }
}
@media screen, print {
body { line-height: 1.2 }
}
Notes
A multimodal media type is still only one media type. The 'tv' media type, for example, is a multimodal media type that renders both visually and aurally to a single canvas.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | 1.0 | 1.0 (1.7)
| 9.0 | 9.2 | 1.3 |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | 1.0 | 1.0 (1.7)
| 9.0 | 9.0 | 3.1 |
This is an experimental feature
Because this feature is still in development in some browsers, check the compatibility table for the proper prefixes to use in various browsers.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
The :-moz-any()
pseudo-class lets you quickly construct sets of similar selectors by establishing groups from which any of the included items will match. This is an alternative to having to repeat the entire selector for the one item that varies.
Note : This pseudo-class is in progress to be standardized in
CSS Selectors Level 4 under the name
:matches()
. It is likely that the syntax and name of
:-moz-any()
will be changed to reflect it in the near future.
Syntax
:-moz-any( selector[, selector]* )
Values
- selector
- A selector. This may be a simple selector or a multiple selector comprised of CSS 3 simple selectors.
Note: The selectors may not contain combinators or pseudo-elements.
Examples
For example, the following CSS:
/* 3 deep (or more) unordered lists use a square */
ol ol ul, ol ul ul, ol menu ul, ol dir ul,
ol ol menu, ol ul menu, ol menu menu, ol dir menu,
ol ol dir, ol ul dir, ol menu dir, ol dir dir,
ul ol ul, ul ul ul, ul menu ul, ul dir ul,
ul ol menu, ul ul menu, ul menu menu, ul dir menu,
ul ol dir, ul ul dir, ul menu dir, ul dir dir,
menu ol ul, menu ul ul, menu menu ul, menu dir ul,
menu ol menu, menu ul menu, menu menu menu, menu dir menu,
menu ol dir, menu ul dir, menu menu dir, menu dir dir,
dir ol ul, dir ul ul, dir menu ul, dir dir ul,
dir ol menu, dir ul menu, dir menu menu, dir dir menu,
dir ol dir, dir ul dir, dir menu dir, dir dir dir {
list-style-type: square;
}
Can be replaced with:
/* 3 deep (or more) unordered lists use a square */
:-moz-any(ol, ul, menu, dir) :-moz-any(ol, ul, menu, dir) ul,
:-moz-any(ol, ul, menu, dir) :-moz-any(ol, ul, menu, dir) menu,
:-moz-any(ol, ul, menu, dir) :-moz-any(ol, ul, menu, dir) dir {
list-style-type: square;
}
Notes
This is particularly useful when dealing with HTML5 sections and headings. Since
<section>
,
<article>
,
<aside>
, and
<nav>
can be nested, without :-moz-any()
, styling these to match one another can be tricky.
For example, without :-moz-any()
, styling all the
<h1>
elements at different depths could be very complicated:
/* Level 0 */
h1 {
font-size: 30px;
}
/* Level 1 */
section h1, article h1, aside h1, nav h1 {
font-size: 25px;
}
/* Level 2 */
section section h1, section article h1, section aside h1, section nav h1,
article section h1, article article h1, article aside h1, article nav h1,
aside section h1, aside article h1, aside aside h1, aside nav h1,
nav section h1, nav article h1, nav aside h1, nav nav h1, {
font-size: 20px;
}
/* Level 3 */
/* ... don't even think about it*/
Using :-moz-any()
, though, it's much easier:
/* Level 0 */
h1 {
font-size: 30px;
}
/* Level 1 */
:-moz-any(section, article, aside, nav) h1 {
font-size: 25px;
}
/* Level 2 */
:-moz-any(section, article, aside, nav)
:-moz-any(section, article, aside, nav) h1 {
font-size: 20px;
}
/* Level 3 */
:-moz-any(section, article, aside, nav)
:-moz-any(section, article, aside, nav)
:-moz-any(section, article, aside, nav) h1 {
font-size: 15px;
}
Browser compatibility
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
Basic support | 4.0 (2)
-moz
| 12.0 (534.30)
-webkit
| | |
Nightly build
-webkit
|
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 1.9
(Firefox 3)
Summary
:-moz-broken
matches elements representing broken image links.
This selector is intended for use mainly by theme developers.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
The @-moz-document
rule is a Gecko-specific at-rule that restricts the style rules contained within it based on the URL of the document. It is designed primarily for user style sheets. A @-moz-document
rule can specify one or more matching functions. If any of the functions apply to a URL, the rule will take effect on that URL.
The functions available are:
-
url()
, which matches an exact URL -
url-prefix()
, which matches if the document URL starts with the value provided -
domain()
, which matches if the document URL is on the domain provided (or a subdomain of it) -
regexp()
, which matches if the document URL is matched by the regular expression provided. The expression must match the entire URL.
Gecko 6.0 note
(Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3)
Support for the regexp()
function was added in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3)
.
Syntax
The values provided to the url()
, url-prefix()
, and domain()
functions can optionally be enclosed by single or double quotes. The values provided to the regexp()
function must be enclosed in quotes.
Escaped values provided to the regexp()
function must additionally escaped from the CSS. For example, a .
(period) matches any character in regular expressions. To match a literal period, you would first need to escape it using regular expression rules (to \.
), then escape that string using CSS rules (to \\.
).
Examples
You can put this into your userContent.css
file:
@-moz-document url(http://www.w3.org/),
url-prefix(http://www.w3.org/Style/),
domain(mozilla.org),
regexp("^https:.*")
{
/* CSS rules here apply to:
+ The page "http://www.w3.org/".
+ Any page whose URL begins with "http://www.w3.org/Style/"
+ Any page whose URL's host is "mozilla.org" or ends with
".mozilla.org"
+ Any page whose URL starts with "https:" */
/* make the above-mentioned pages really ugly */
body { color: purple; background: yellow; }
}
Browser compatibility
Available since Mozilla 1.8 / Firefox 1.5.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
The :-moz-drag-over
pseudo-class is used to edit an element when a drag-over event is called on it.
Syntax
element:-moz-drag-over { style properties }
Examples
td:-moz-drag-over { color:red; }
...where...
<table border="1">
<tr>
<td width="100px" height="100px">Drag Over</td>
</tr>
</table>
...result...
...
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
The :-moz-first-node
pseudo-class represents any element that is the first child node of some other element. It differs from
:first-child
because it does not match a first child element with (non-whitespace) text before it.
Syntax
span:-moz-first-node { style properties }
Examples
span:-moz-first-node
{
background-color: lime;
}
...where...
<div>
<span>:-moz-first-node</span>
<span>:-moz-last-node</span>
</div>
Notes
Any white space at the start of an element is ignored for the determination of :-moz-first-node
.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 2
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Summary
:-moz-focusring
is specified on an element if and only if it's currently focused and should have a focus ring drawn about it. The precise behavior may vary from platform to platform, depending on that platform's particular focus best practices.
Note: Keep in mind that not all focused elements will have this pseudo-selector specified; it's only applied when the element is both focused and should render a focus indicator.
Example
To specify the appearance of an element when it's focused, you can use this pseudo-selector like this:
mybutton:-moz-focusring {
outline: 2px dotted;
}
« CSS « CSS Reference
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | ? | 9.0 (9.0)
| ? | ? | ? |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | ? | 9.0 (9.0)
| ? | ? | ? |
Specification
Not part of any specification.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 1.9.1
(Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)
Summary
:-moz-handler-blocked
matches elements that cannot be displayed because their handlers have been blocked.
This is primarily useful for theme developers.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 2.0
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Summary
:-moz-handler-crashed
matches elements that cannot be displayed because the plugin responsible for drawing them has crashed.
This is primarily useful for theme developers.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 1.9.1
(Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)
Summary
:-moz-handler-disabled
matches elements that cannot be displayed because their handlers have been disabled by the user.
This is primarily useful for theme developers.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
The :-moz-last-node
pseudo-class matches an element that is the last child node of some other element. It differs from
:last-child
because it does not match a last child element with (non-whitespace) text after it.
Syntax
span:-moz-last-node { style properties }
Examples
span:-moz-last-node
{
background-color: lime;
}
...where...
<div>
<span>:-moz-first-node</span>
<span>:-moz-last-node</span>
</div>
Notes
Any white space at the end of an element is ignored for the determination of :-moz-last-node
.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
The ::-moz-list-bullet
pseudo-class is used to edit the bullet of a list element.
Syntax
li::-moz-list-bullet { style properties }
Examples
.liste li::-moz-list-bullet{ font-size:36px }
...where...
<ul>
<li>Number 1</li>
<li>Number 2</li>
<li>Number 3</li>
</ul>
<ul class="liste">
<li>Number 1</li>
<li>Number 2</li>
<li>Number 3</li>
</ul>
...result...

« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
The ::-moz-list-number
pseudo-class lets you customize the appearance of numbers on list items (
<li>
) occurring in ordered lists (
<ol>
).
Syntax
li::-moz-list-number { style properties }
Examples
<style type="text/css">
li::-moz-list-number {
font-style: italic;
font-weight: bold;
}
</style>
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
Gives the following result:

View the live example
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 1.9
(Firefox 3)
Summary
:-moz-loading
matches elements none of which can be displayed because they have not started loading, such as images that haven't started to arrive yet. Note that images that are in the process of loading are not matched by this pseudo-class.
This is primarily useful for theme developers.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 1.9.2
(Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0)
Summary
:-moz-locale-dir(ltr)
matches an element if the user interface is being displayed left-to-right. This is determined by the preference intl.uidirection.
locale
(where locale
is the current locale) being set to "ltr".
This allows extensions (and themes) to easily adapt their user interface based on the user's locale's needs. This can vary from window to window, and even from tab to tab. This also allows extensions to work even if they don't support the user's default locale, since they can support both left-to-right and right-to-left layouts without worrying about the locale specifics.
This selector does not work properly from HTML; it always matches, no matter whether the UI locale is left-to-right or right-to-left.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 1.9.2
(Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0)
Summary
:-moz-locale-dir(rtl)
matches an element if the user interface is being displayed right-to-left. This is determined by the preference intl.uidirection.
locale
(where locale
is the current locale) being set to "rtl".
This allows extensions (and themes) to easily adapt their user interface based on the user's locale's needs. This can vary from window to window, and even from tab to tab. This also allows extensions to work even if they don't support the user's default locale, since they can support both left-to-right and right-to-left layouts without worrying about the locale specifics.
This selector does not work properly from HTML; it never matches, no matter whether the UI locale is left-to-right or right-to-left.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
The :-moz-lwtheme-brighttext
pseudo-class matches in chrome documents when
:-moz-lwtheme
is true and a lightweight theme with a bright text color is selected.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
The :-moz-lwtheme-darktext
pseudo-class matches in chrome documents when
:-moz-lwtheme
is true and a lightweight theme with a dark text color is selected.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
The :-moz-lwtheme
pseudo-class matches in chrome documents when the root element's
lightweightthemes
attribute is true
and a theme is selected.
« CSS « CSS Reference
Summary
The :-moz-only-whitespace
pseudo-class matches an element that has no child nodes at all or empty text nodes or text nodes that have only white-space in them. Only when there are element nodes or text nodes with one or more characters inside the element, the element doesn't match this pseudo-class anymore.
Syntax
span:-moz-only-whitespace { style properties }
Examples
span:-moz-only-whitespace::before
{
background-color: lime;
}
...where...
<span> </span>
Notes
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 2.0
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Summary
The :-moz-placeholder
pseudo-class represents any form element displaying placeholder text. This allows web developers and theme designers to customize the appearance of placeholder text, which is a light grey color by default. This may not work well if you've changed the background color of your form fields to be a similar color, for example, so you can use this pseudo-class to change the placeholder text color.
Example
This example styles the placeholder text by making it green.
<!doctype html>
<html>
<head>
<title>Placeholder demo</title>
<style type="text/css">
input:-moz-placeholder {
color: green;
}
</style>
</head>
<body>
<input id="test" placeholder="Placeholder text!">
</body>
</html>
View this example live.
Notes
Note: This was previously incorrectly documented as having been created for Gecko 1.9 (Firefox 3)
, for an
entirely different purpose.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 2.0
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Summary
The :-moz-submit-invalid
CSS pseudo-class represents any submit button on forms whose contents aren't valid based on their validation constraints.
By default, no style is applied. You can use this style to customize the appearance of the submit button when there are invalid form fields.
Browser compatibility
Browser | Lowest version |
Internet Explorer | --- |
Firefox (Gecko) | 4.0 (2.0) |
Opera | ? |
Safari (WebKit) | ? |
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 1.9
(Firefox 3)
Summary
:-moz-suppressed
matches elements representing images that were not loaded because loading images from that site has been blocked.
This selector is intended for use mainly by theme developers.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
This content covers features introduced in Firefox 3.
Summary
:-moz-system-metric(images-in-menus)
will match an element if the computer's user interface supports images in menus.
This selector is intended for use mainly by theme developers.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 1.9.1
(Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)
Summary
:-moz-system-metric(mac-graphite-theme)
will match an element if the user has chosen the "Graphite" appearance in the "Appearance" prefpane of the Mac OS X System Preferences.
This selector is intended for use mainly by theme developers.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
This content covers features introduced in Firefox 3.
Summary
:-moz-system-metric(scrollbar-end-backward)
will match an element if the computer's user interface includes a backward arrow button at the end of scrollbars.
This selector is intended for use mainly by theme developers.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
This content covers features introduced in Firefox 3.
Summary
:-moz-system-metric(scrollbar-end-forward)
will match an element if the computer's user interface includes a forward arrow button at the end of scrollbars.
This selector is intended for use mainly by theme developers.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 1.9
(Firefox 3)
Summary
:-moz-system-metric(scrollbar-start-backward)
will match an element if the computer's user interface includes a backward arrow button at the start of scrollbars.
This selector is intended for use mainly by theme developers.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
This content covers features introduced in Firefox 3.
Summary
:-moz-system-metric(scrollbar-start-foreward)
will match an element if the computer's user interface includes a forward arrow button at the start of scrollbars.
This selector is intended for use mainly by theme developers.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
This content covers features introduced in Firefox 3.
Summary
:-moz-system-metric(scrollbar-thumb-proportional)
will match an element if the computer's user interface uses proportional scrollbar thumbs; that is, the draggable thumb on the scrollbar resizes to indicate the relative size of the visible area of the document.
This selector is intended for use mainly by theme developers.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 1.9.2
(Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0)
Summary
:-moz-system-metric(touch-enabled)
will match an element if the device on which the content is being rendered offers a supported touch-screen interface.
Note: This is not intended for use in web content. Use the
-moz-touch-enabled
media query instead.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
This content covers features introduced in Firefox 3.
Summary
:-moz-system-metric(windows-default-theme)
will match an element if the user is currently using one of the following themes in Windows: Luna, Royale, Zune, or Aero (i.e., Vista Basic, Vista Standard, or Aero Glass). This will exclude Windows Classic themes as well as third-party themes.
This selector is intended for use mainly by theme developers.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Activated by the 'properties' attribute.
Style Properties
- background
- border
- margin
- outline
- padding
- visibility
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Activated by the 'properties' attribute.
Style Properties
- font
- visibility
- color
- text-decoration
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 1.9
(Firefox 3)
Summary
:-moz-tree-cell-text(hover)
will match an element if the mouse cursor is presently hovering over text in a tree cell.
This selector is intended for use mainly by theme developers.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Activated by the 'properties' attribute.
Style Properties
- margin
- visibility
- text style
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Activated by the 'properties' attribute.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Activated by the 'properties' attribute.
Style Properties
- margin
- list style
- position
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Activated by the 'properties' attribute.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Activated by the 'properties' attribute.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Activated by the when the 'type' attribute is set to 'progressmeter'.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
-moz-tree-row
is used to select rows and apply style to tree rows.
Syntax
treechildren::-moz-tree-row { style properties }
Style Properties
- background
- border
- margin
- outline
- padding
- display
- -moz-appearance
Examples
treechildren::-moz-tree-row( foo bar )
{
margin: 2%;
}
...where...
<treerow properties="foo">...</treerow>
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
This content covers features introduced in Firefox 3.
Summary
:-moz-tree-row(hover)
will match an element if the mouse cursor is presently hovering over a tree row.
This selector is intended for use mainly by theme developers.
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Activated by the 'properties' attribute.
Style Properties
- border
- display
- -moz-appearance
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Activated by the 'properties' attribute.
Style Properties
- border
- margin
- padding
- display
- list style
- position
- -moz-appearance
Summary
The :-moz-ui-invalid
CSS pseudo-class represents any validated form element whose value isn't valid based on their validation constraints, in certain circumstances. This pseudo-class is applied according to the following rules:
- If the control does not have focus, and the value is invalid, apply this pseudo-class.
- If the control has focus, and the value was valid (including empty) when it gained focus, do not apply the pseudo-class.
- If the control has focus, and the value was invalid when it gained focus, re-validate on every keystroke.
- If the element is required, the preceding rules apply only if the user has changed the value or attempted to submit the form.
The result is that if the control was valid when the user started interacting with it, the validity styling is changed only when the user shifts focus to another control. However, if the user is trying to correct a previously-flagged value, the control shows immediately when the value becomes valid. Required items have the pseudo-class applied only if the user changes them or attempts to submit an unchanged valid value.
By default, Gecko applies a style that creates a red "glow" (using the
box-shadow
property) around items with that have this pseudo-class applied. See the
:invalid
pseudo-class for an example that shows how to override the default style.
Browser compatibility
Browser | Lowest version |
Internet Explorer | --- |
Firefox (Gecko) | 4.0 (2.0) |
Opera | ? |
Safari (WebKit) | ? |
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 2.0
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Summary
The :-moz-ui-valid
CSS pseudo-class represents any validated form element whose value validates correctly based on its validation constraints.
This pseudo-class is applied according to the following rules:
- If the control does not have focus, and the value is valid, apply this pseudo-class.
- If the control has focus, and the value was valid (including empty) when it gained focus, apply this pseudo-class.
- If the control has focus, and the value was invalid when it gained focus, re-validate on every keystroke.
- If the element is required, the preceding rules apply only if the user has changed the value or attempted to submit the form.
The result is that if the control was valid when the user started interacting with it, the validity styling is changed only when the user shifts focus to another control. However, if the user is trying to correct a previously-flagged value, the control shows immediately when the value becomes valid. Required items are flagged as invalid only if the user changes them or attempts to submit an unchanged invalid value.
Browser compatibility
Browser | Lowest version |
Internet Explorer | --- |
Firefox (Gecko) | 4.0 (2.0) |
Opera | ? |
Safari (WebKit) | ? |
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Introduced in Gecko 1.9
(Firefox 3)
Summary
:-moz-user-disabled
matches elements representing images that were not loaded because images have been entirely disabled by the user's preferences.
This selector is intended for use mainly by theme developers.
« CSS « CSS Reference
Introduced in Gecko 2
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Summary
The :-moz-window-inactive
pseudo-class matches any element while it's in an inactive window.
Note: Prior to the addition of this attribute, giving different styles to background windows was achieved by setting an attribute (active="true") on the top level XUL chrome window. This attribute is no longer used.
:-moz-window-inactive
works in content HTML documents, too.
Example
This example alters the appearance of a box's background depending on whether its window is active or not.
<style type="text/css">
#mybox {
background: -moz-linear-gradient(top, blue, cyan);
}
#mybox:-moz-window-inactive {
background: cyan;
}
</style>
<div id="mybox" style="width:200px; height:200px;">
<p>This is a box!</p>
</div>
You can view this as a live sample here.
This was implemented in bug 508482.
« CSS « CSS Reference
Summary
The negation pseudo-class, :not(X),
is a functional notation taking a simple selector X as an argument. It matches an element that is not represented by the argument. X must not contain another negation selector, or any pseudo-elements.
The specificity of the :not
pseudo-class is the specificity of its argument. The :not
pseudo-class does not add to the selector specificity, unlike other pseudo-classes.
Notes:
- Useless selectors can be written using this pseudo-class. E.g.
:not(*)
matching any element which is not any element will never be applied. - It is possible to rewrite other rules. E.g.
foo:not(bar)
will match the same element than the simple foo
. Nevertheless the specificity of the first one is higher.
Syntax
:not(selector) { style properties }
Examples
Usage Example
p:not(.classy) { color: red; }
:not(p) { color: green; }
...where...
<p>Some text.</p>
<p class="classy">Some other text.</p>
<span>One more text<span>
...should look like...
Some text.
Some other text.
One more text
Browser compatibility
Browser | Lowest Version |
Internet Explorer | 9.0 |
Firefox (Gecko) |
1.0 (1.0) |
Opera | 9.5 |
Safari (WebKit) |
1.0 (85) |
« CSS « CSS Reference
Summary
The :nth-child
pseudo-class matches an element that has an+b-1
siblings before it in the document tree, for a given positive or zero value for n
, and has a parent element.
This can more clearly be described this way: the matching element is the bth
child of an element after all its children have been split into groups of a
elements each.
The values a
and b
must both be integers, and the index of an element's first child is 1.
Among other things, this allows selectors to match every other row in a table.
Syntax
element:nth-child(an + b) { style properties }
Examples
Example selectors
tr:nth-child(2n+1)
- Represents the odd rows of an HTML table.
tr:nth-child(odd)
- Represents the odd rows of an HTML table.
tr:nth-child(2n)
- Represents the even rows of an HTML table.
tr:nth-child(even)
- Represents the even rows of an HTML table.
span:nth-child(0n+1)
- Represents a span element which is the first child of its parent; this is the same as the
:first-child
selector. span:nth-child(1)
- Equivalent to the above.
span:nth-child(-n+3)
- Three first span elements.
Usage example
span:nth-child(2n+1)
{
background-color: lime;
}
...where...
<div>
<span>This span is limed!</span>
<span>This span is not. :(</span>
<span>But this one is!</span>
<span>Sadly, this one is not...</span>
</div>
... should look like ...
This span is limed!
This span is not. :(
But this one is!
Sadly, this one is not...
Specifications
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | 4.0 | 3.5 (1.9.1)
| 9 | 10.10 | 4 |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
Notes
- Opera can't handle dynamic insertion of elements.
« CSS « CSS Reference
Introduced in Gecko 1.9.1
(Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)
Summary
The :nth-last-child
pseudo-class matches an element that has an+b-1
siblings after it in the document tree, for a given positive or zero value for n
, and has a parent element. See
:nth-child
for a more thorough description of the syntax of its argument.
Syntax
element:nth-last-child(an + b) { style properties }
Examples
Example selectors
-
tr:nth-last-child(-n+4)
- Matches the last four rows of an HTML table.
-
span:nth-last-child(even)
- Matches the even elements in their parent element, starting at the last element and working backward.
« CSS « CSS Reference
Introduced in Gecko 1.9.1
(Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)
Summary
The :nth-last-of-type
pseudo-class matches an element that has an+b-1
siblings with the same element name after it in the document tree, for a given positive or zero value for n
, and has a parent element. See
:nth-child
for a more thorough description of the syntax of its argument.
Syntax
element:nth-last-of-type(an + b) { style properties }
« CSS « CSS Reference
Introduced in Gecko 1.9.1
(Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)
Summary
The :nth-of-type
pseudo-class matches an element that has an+b-1
siblings with the same element name before it in the document tree, for a given positive or zero value for n
, and has a parent element. See
:nth-child
for a more thorough description of the syntax of its argument.
Syntax
element:nth-of-type(an + b) { style properties }
Examples
Example
This example causes the positions of floated images to alternate between right and left.
img:nth-of-type(2n+1) { float: right; }
img:nth-of-type(2n) { float: left; }
Summary
The :only-child
pseudo-class represents any element which is the only child of its parent.
Syntax
parent child:only-child {
property:value;
}
Examples
div span:only-child {
color:red;
}
<div>
<span>Some red text</span>
</div>
<div>
<span>Some regular text</span>
<span>Some regular text</span>
</div>
Result
Some red text
Some regular text Some regular text
Specifications
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | 2 | 1.5 (1.8)
| 9 | 9.5 | 3.1 |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | 2.1 | 1.0 (1.8)
| 9 | 10.0 | 3.1 |
« CSS « CSS Reference
Introduced in Gecko 1.9.1
(Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)
Summary
The :only-of-type
pseudo-class represents any element that have no siblings of the given type.
Syntax
element:only-of-type { style properties }
« CSS « CSS Reference
Summary
The :optional
CSS pseudo-class represents any
<input>
element that does not have the
required
attribute set on it. This allows forms to easily indicate optional fields, and to style them accordingly.
To provide an appearance for required form fields, the
:required
pseudo-class may be used.
Browser compatibility
Feature | Firefox | Chrome | Internet Explorer | Safari | Opera |
Basic support | 4 | 8 | -- | 5 | 9.5 |
Summary
The @page rule is used to modify some CSS properties when printing a document.
Note: you can not change all CSS properties. You can only change the margins, orphans, widows, and page breaks of the document. All other CSS properties will be ignored.
Syntax
@page :pseudo-class {
margin:2in;
}
Examples
Please refer to the various pseudo-classes of @page for examples.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | 2.0 | -- | 8.0 | 6.0 | 5.0 |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The :required
CSS pseudo-class represents any
<input>
element that has the
required
attribute set on it. This allows forms to easily indicate which fields must have valid data before the form can be submitted.
The
:optional
pseudo-class may be used to provide an appearance for optional form fields.
Browser compatibility
Browser | Lowest version |
Internet Explorer | --- |
Firefox (Gecko) | 4.0 (2.0) |
Opera | 9.5 |
Safari | Chrome | WebKit | 5 | 8 | 534.10 |
« CSS « CSS Reference
Summary
The :right
page pseudo-class matches any right page when printing a page. It allows to describe the styling of right-side page.
Whether the page is left or right is decided by the major writing direction of the document. For example, if the first page has a major writing direction of left-to-right then it will be a :right page and if it has a major writing direction of right-to-left then it will be a :left
page.
Note: You can't change all CSS properties. You can only change the the margin, padding, border, and background properties of the page box. All other CSS properties will be ignored, and only the page box, not the document content on the page, will be affected.
Examples
@page :right {
margin: 2in 3in;
}
Browser compatibility
Browser | Lowest Version |
Internet Explorer |
8.0 |
Firefox (Gecko) | --- |
Opera |
9.2 |
Safari (WebKit) | --- |
« CSS « CSS Reference
Summary
The :root
pseudo-class matches the root element of a tree representing the document. In HTML, :root
represents the
<html>
element and is identical to the selector html
, except that its specifity is higher.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | 1 | 1.0 (1.7)
| 9 | 9.5 | 1.0 |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The :target
pseudo-class represents the unique element, if any, with an id matching the fragment identifier of the URI of the document..
URIs with fragment identifiers link to a certain element within the document, known as the target element. For instance, here is a URI pointing to an anchor named section2:
http://example.com/folder/document.html#section2
The anchor can be any element with an id
attribute, e.g. <h1 id="section2">
in our example. The target element h1
can be represented by the :target
pseudo-class.
Examples
:target { outline: solid red } /* draw a red, solid line around the target element */
/* example code for userContent.css or any web pages;
a red/yellow arrow indicates the target element */
:target {
-moz-box-shadow: 0.2em 0.2em 0.3em #888;
-webkit-box-shadow: 0.2em 0.2em 0.3em #888;
}
:target:before {
font: 70% Arial,"Nimbus Sans L",sans-serif !important;
content: "\25ba"; /* ► */
color: red;
background: gold;
border: solid thin;
padding-left: 1px;
display: inline-block;
margin-right: 0.13em;
vertical-align: 20%;
}
Note
The id
attribute was new in HTML 4 (December 1997). In old-style HTML <a name="foo">
is a target element. The :target
pseudo-class applies to those targets as well.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
Basic support | ? | (1.3)
| 9 | 9.5 | 1.3 |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
Basic support | ? | ? | ? | ? | ? |
« CSS « CSS Reference
Summary
The :valid
CSS pseudo-class represents any
<input>
element whose content validates correctly according to the input's type setting. This allows to easily make valid fields adopt an appearance that helps the user confirm that their data is formatted properly.
Browser compatibility
Browser | Lowest version |
Internet Explorer | --- |
Firefox (Gecko) | 4.0 (2.0) |
Opera | 9.5 |
Safari | Chrome | WebKit | 5 | 8 | 534.10 |
« CSS « CSS Reference
Summary
The :visited
pseudo-class lets you select only links that have been visited.
Gecko 2.0 note
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
Starting in Firefox 4, major limitations to the styles you can apply using this selector have been introduced. For more information on the limitations and the motivation for them, see
Privacy and the :visited selector
. The same limitations have been adopted by other browsers, including Safari 5/4.1 and Chrome 6.
Examples
a:visited { color: #4b2f89; }
a:visited { background-color: white }
Browser compatibility
Browser | Lowest Version |
Internet Explorer | 3.5 |
Firefox | 1.0 |
Opera | 3.5 |
Safari | 1.0 |
« CSS « CSS Reference
Summary
The :first-letter
CSS pseudo-element selects the first letter of the first line of a block, if it is not preceded by any other content (such as images or inline tables) on its line.
Examples
/* make the first letter of every paragraph red and big */
p:first-letter { color: red; font-size: 130%; }
Browser compatibility
CSS 3 introduced the ::first-letter
notation in order to establish a discrimination between pseudo-classes and pseudo-elements. Don't use the double colon notation yet for compatibility with Internet Explorer.
Browser | Lowest Version | Support of |
Internet Explorer | 5.5 | :first-letter |
Firefox (Gecko) | 1.0 (1.0) | :first-letter |
1.0 (1.5) | :first-letter | ::first-letter |
Opera | 3.5 | :first-letter |
7.0 | :first-letter | ::first-letter |
Safari (WebKit) | 1.0 | :first-letter | ::first-letter |
« CSS « CSS Reference
Summary
The :first-line
CSS pseudo-element applies styles to the first line of a element. However, the selector :first-line
does not match any real HTML element.
Examples
/* change the letters of the first line of every paragraph to uppercase */
p:first-line { text-transform: uppercase }
Browser compatibility
Browser | Lowest version | Support of |
Internet Explorer | 5.5 | :first-line |
Firefox (Gecko) | 1.0 (1.0) | :first-line |
1.0 (1.5) | :first-line | ::first-line |
Opera | 3.5 | :first-line |
7.0 | :first-line | ::first-line |
Safari (WebKit) | 1.0 (85) | :first-line | ::first-line |
For compatibility with IE 5.5-8 avoid CSS3 notation ::first-line
(use CSS2 notation :first-line
).
« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
The ::-moz-progress-bar
pseudo-element applies to the area of an HTML
<progress>
element that represents the amount of progress that has happened so far. This lets you, for example, change the color of progress bars.
You have pretty broad capabilities to style the bar. This can be especially useful with indeterminate bars (via the
:indeterminate
pseudo-class), where you may wish to substantially change the default appearance; you can change the width and positioning of the bar, for example. (By which we probably mean the whole element's dimensions and position, not just the painted part of the element, as featured in the screen shot below.)
Examples
This example styles the progress meter portion of the progress bar with ID redbar
with the color red.
#redbar::-moz-progress-bar {
background-color: red;
}
A bar using this style might look something like this:

« CSS « CSS Reference « CSS Reference:Mozilla Extensions
Summary
The ::-moz-selection
(::selection
) pseudo-element applies to the portion of a document that has been highlighted (e.g. selected with the mouse) by the user.
Examples
/* draw any selected text yellow on red background */
::-moz-selection { color: gold; background: red; }
::selection { color: gold; background: red; }
/* draw selected text in a paragraph white on black */
p::-moz-selection { color: white; background: black; }
p::selection { color: white; background: black; }
Notes
Gecko/Firefox supports ::-moz-selection
, use also ::selection
for some other browsers.
The following properties apply to ::-moz-selection
:
color, background
and background-color
(background-image
is ignored).
Specifications
::selection
was drafted for CSS3 Selectors but removed from the current CSS3 draft. Anyhow, it's implemented in browsers and support will continue.
Browser compatibility
Requires two different rules with identical declarations as stated in the examples above.
Browser | Lowest Version | Support of |
Internet Explorer | 9 | ::selection |
Firefox (Gecko) |
1.0 (1.5) | ::-moz-selection |
Opera | 9.5 | ::selection |
Safari (WebKit) |
1.1 (100) | ::selection |
« CSS « CSS Reference
Summary
The z-index
CSS property specifies the z-order of an element and its descendants. When elements overlap, z-order determines which one covers the other. An element with a larger z-index generally covers an element with a lower one.
For a positioned box, the z-index
property specifies:
- The stack level of the box in the current stacking context.
- Whether the box establishes a local stacking context.
Syntax
z-index: auto | <integer> | inherit
Values
- auto
- The box does not establish a new local stacking context. The stack level of the generated box in the current stacking context is the same as its parent's box.
- <integer>
- This integer is the stack level of the generated box in the current stacking context. The box also establishes a local stacking context in which its stack level is
0
. This means that the z-indexes of descendants are not compared to the z-indexes of elements outside this element.
Examples
position:relative; z-index:1; position:absolute; z-index:3;
left:20em; top:-25px; opacity:0.9 position:absolute; z-index:2; left:60px; top:3em;
Notes
Negative z-index
values are supported correctly starting in Gecko 1.9 / Firefox 3. Previous versions implemented the CSS 2 behavior, not the CSS 2.1 behavior that is compatible with other browsers.
Browser compatibility
Browser | Lowest Version |
Internet Explorer | 4.0 |
Firefox (Gecko) | 1.0 (1.0) |
Opera | 4.0 |
Safari (WebKit) | 1.0 (85) |