THE WORLD'S LARGEST WEB DEVELOPER SITE

CSS border Property


Example

Set the style of the four border:

p {
    border: 5px solid red;
}

Try it yourself »

Definition and Usage

The border shorthand property sets all the border properties in one declaration.

The properties that can be set, are (in order): border-width, border-style, and border-color.

It does not matter if one of the values above are missing, e.g. border:solid #ff0000; is allowed.

Default value: medium none color
Inherited: no
Animatable: yes, see individual properties. Read about animatable Try it
Version: CSS1
JavaScript syntax: object.style.border="3px solid blue" Try it

Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property
border 1.0 4.0 1.0 1.0  3.5

CSS Syntax

border: border-width border-style border-color|initial|inherit;

Property Values

Value Description
border-width Specifies the width of the border. Default value is "medium"
border-style Specifies the style of the border. Default value is "none"
border-color Specifies the color of the border. Default value is the color of the element
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

Related Pages

CSS tutorial: CSS Border

CSS tutorial: CSS Box Model

HTML DOM reference: border property


COLOR PICKER

colorpicker

SHARE THIS PAGE






Search w3schools.com:

Translate w3schools.com: