Skip to main content

CSS Border Width

The border-width property sets the width of the four borders.

You can give a specific size (in px, pt, cm, em, and so on) or use one of three preset values: thin, medium, or thick.

Example

Each paragraph uses a different border width.

Prompt
An HTML page that demonstrates different border-width values. In an internal <style> block, make four paragraph classes: solid 5px, solid medium, dotted 2px, and dotted thick. Each must also set border-style. Add a paragraph for each, labeling the width used.
Output: complete HTML page

Specific Side Widths

The border-width property can take from one to four values, for the top, right, bottom, and left borders.

Example

Two values set top/bottom and sides, while four values set each side on its own.

Prompt
An HTML page that shows how border-width can take one to four values for the four sides. In an internal <style> block, make three solid-bordered paragraph classes: one with "5px 20px", one with "20px 5px", and one with "25px 10px 4px 35px". Add a paragraph for each.
Output: complete HTML page