How to create a border in HTML

HTML disposes of a feature which can be used to create a border. Nevertheless this is an old-fashioned process. Nowadays a website’s structure is built in HTML and all styles, including the border style, are created in the stylesheet. The creation of a border in CSS is fairly straightforward. By using the following code you can easily create a black border in HTML:

border: 1px solid black;

De above css in fact means:

  • The border has to be 1px wide;
  • The border has to be solid;
  • De border has to be black.


The width and colour are straightforward, by with regards to ‘solid’ various options are available:

  • dotted
  • dashed
  • outset
  • inset
  • grooved
  • double
  • ridged
  • mixed (this option requires the CSS feature ‘border-style: ; ‘. 4 Of the above values can be chosen for each border.)

Was this useful?