XML technologies / CSS / Advanced websites with CSS / CSS property reference / outline
(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)
An element’s outline (outline) is similar to its border (border). However, it takes up no space in the CSS box model and therefore does not affect the positioning of other elements. Also, outline does not create a rectangular box around the element but follows the irregular edge of a text paragraph. Unlike its border, the outline of an inline element spanning multiple lines always extends from the start to the end of each line.
The shorthand property outline lets you declare the properties outline-color, outline-style and outline-width in one declaration. All three properties can also be declared separately.
Inherited: no
See also: border, outline-color, outline-style, outline-width
Values
The syntax for the property outline is as follows. Values are separated by spaces:
outline: [color] [style] [width]
color represents a valid value for outline-color, style represents a valid value for outline-style, width represents a valid value for outline-width.
All three values are optional, but at least one must be declared. Values can appear in any order. Any undeclared value automatically takes its default.
Default value: none
Compatibility
CSS version: 2
Works only in Internet Explorer 5 for Macintosh and Opera 7, but, contrary to the CSS2 specification, only as a rectangular outline (like border).
Example
The following style rule uses the pseudo-class :focus to create a dashed, red, medium-width outline around the input field element:
input:focus, select:focus, textarea:focus {
outline: medium dashed red;
}
Copyright © 2006 of the German translation, dpunkt.verlag GmbH
You may print the online version for your private use.
Otherwise, this chapter from “CSS − Anspruchsvolle Websites mit Cascading Stylesheets” is subject to the same conditions as the bound edition: the work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
dpunkt.verlag GmbH, Ringstraße 19, 69115 Heidelberg