CSS Border

<!DOCTYPE html>
<html>
<head>
  <title>CSS Border</title>
  <style>
    .my-element {
      border: 1px solid #000000;
      padding: 20px;
    }
  </style>
</head>
<body>
  <div class="my-element">
    <h1>CSS Border!</h1>
    <p>This is an example of CSS border style applied.</p>
  </div>
</body>
</html>

Code Output

CSS Border

It is used to define the border around an element. It allows you to specify the border width, style, and color.

Syntax

border: [border-width] [border-style] [border-color];

    • [border-width] specifies the width of the border.
    • [border-style] defines the style of the border. It can be set to values like solid, dashed, dotted, double, groove, ridge, inset, outset, or none.
    • [border-color] sets the color of the border.