Web4College

CSS border property

src

Description

CSS border property defines width, style and color of the border for all the sides of a box.

Syntax

border : border-width    border-style    border-color;

Property values

border-width

mediumDefault

medium value represents medium sized border. thin≤medium≤thick

border-width: medium;
Try it

thin

thin value defines thin line border.

border-width: thin;
Try it

thick

thick value defines a thick line border.

border-width: thick;
Try it

+ve length

10

lenght defines the line width of border. The used units might be px, in, em, pt.

border-width: 10px;
Try it

border-style

noneDefault

There is no style. In this case, the color and width of border are also ignored i.e. 0px border.

border-style: none;
Try it

solid

The border consists of a solid line.

border-style: solid;
Try it

hidden

It is same as 'none' but resolve to different results for the border-collapse property in tables.

border-style: hidden;
Try it

dashed

The border consists of a series of square shaped dashes.

border-style: dashed;
Try it

dotted

The border consists of a series of round dots.

border-style: dotted;
Try it

double

The border consists of two lines. The total border-width equals to the two lines and space between them.

border-style: double;
Try it

ridge

The content seems to be coming out of the canvas. It is obtained by producing the box-shadow from the two colors that are lighter and darker than the border-color.

The outer side of the border is darker than the inner side of the border.

border-style: ridge;
Try it

groove

The content seems to be going into the canvas. It is obtained by producing the box-shadow from the two colors that are lighter and darker than the border-color.

The inner side of the border is darker than the outer side of the border.

border-style: groove;
Try it

inset

The color of top and left borders is darker than border-color but the color of right and bottom borders is the same as border-color.

The effect of inset value can be observed in border.

border-style: inset;
Try it

outset

The color of top and left sides is the same as border-left but the color of right and bottom sides is darker than border-color.

The effect of inset value can be observed in border.

border-style: outset;
Try it

border-color

currentColorDefault

currentColor keyword represents the same color for the border as of text color.

border-color: currentColor;
Try it

color-name

The following demo represents skyblue color for the border.

border-color: skyblue;
Try it

rgb value

#000000

It represents rgb value of a color.

The hexadecimal value of red color for the border is given below.

border-color: rgb(255,0,0);
Try it

hexadecimal value

#000000

It represents hexadecimal notation of red color.

The hexadecimal notation of blue color for the border is given below.

border-color: #0000ff;
Try it

Applicable to

See longhand properties