- Instant help with your CSS coding problems

Set border for HTML element

Question:
How to set border for HTML element?
Answer:
.bordered-item {
  border: 1px solid #f1a151;
}
Description:

The border shorthand CSS property sets an element's border. It sets the values of border-width , border-style , and border-color .

The border property may be specified using one, two, or three of the values listed below. The order of the values does not matter.

Borders and outlines are very similar. However, outlines differ from borders in the following ways:

  • Outlines never take up space, as they are drawn outside of an element's content.
  • According to the spec, outlines don't have to be rectangular, although they usually are.
Share "How to set border for HTML element?"
Tags:
border shorthand, border width, border style, border color
Technical term:
Set border for HTML element