CSS PROPERTIES
Expand All | Collapse All
CSS AT-RULES

CSS outline Property

Topic: CSS3 Properties ReferencePrev|Next

Description

The outline property sets the width, style, and color for all four sides of an element's outline. It is a shorthand property for setting the individual outline properties i.e. outline-width, outline-style, and outline-color in a single declaration.

The following table summarizes the usages context and the version history of this property.

Default value: See individual properties
Applies to: All elements
Inherited: No
Animatable: Yes, as some of the properties of the shorthand are animatable. See animatable properties.
Version: CSS 2, 3

Syntax

The syntax of the property is given with:

outline [ outline-width outline-style outline-color ] | initial | inherit

Note: If any property listed above is missing or omitted, the default value for that property will be inserted, if any. See individual properties for details.

The example below shows the outline property in action.

p.one {
    outline: 2px solid #ff0000;
}
p.two {
    color: #00ff00;
    outline-top: 5px solid;
}

Note: If outline-color is missing or not specified (e.g. outline: 5px solid;) the value of the element's color property will be used instead. But, in the case of outline-style, omitting the value will cause no outline to show at all, because the default value for outline-style property is none.


Property Values

The following table describes the values of this property.

Value Description
outline-width Sets the width of the outline of an element.
outline-style Sets the line style of the outline of an element.
outline-color Sets the color of the outline of an element.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element outline property.

Browser Compatibility

The outline property is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1.5+
  • Google Chrome 1+
  • Internet Explorer 8+
  • Apple Safari 1.2+
  • Opera 7+

Further Reading

See tutorial on: CSS Outline, CSS Border.

Related properties: outline-width, outline-style, outline-color

Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties