Usage of border-bottom-width property in CSS

The border-bottom-width property sets the thickness of an element's bottom border. It only takes effect when border-style is defined, as borders need a style to be visible.

Syntax

border-bottom-width: value;

Values

The property accepts the following values:

  • thin - A thin border (typically 1px)
  • medium - A medium border (typically 3px)
  • thick - A thick border (typically 5px)
  • length - Custom width in px, em, rem, etc.
  • inherit - Inherits from parent element

Example with Different Widths

<!DOCTYPE html>
<html>
<head>
    <style>
        .thin-border {
            border-bottom-width: thin;
            border-style: solid;
            border-color: #333;
            padding: 10px;
            margin: 10px 0;
        }
        .medium-border {
            border-bottom-width: medium;
            border-style: solid;
            border-color: #333;
            padding: 10px;
            margin: 10px 0;
        }
        .thick-border {
            border-bottom-width: thick;
            border-style: solid;
            border-color: #333;
            padding: 10px;
            margin: 10px 0;
        }
        .custom-border {
            border-bottom-width: 8px;
            border-style: solid;
            border-color: #333;
            padding: 10px;
            margin: 10px 0;
        }
    </style>
</head>
<body>
    <p class="thin-border">This has a thin bottom border</p>
    <p class="medium-border">This has a medium bottom border</p>
    <p class="thick-border">This has a thick bottom border</p>
    <p class="custom-border">This has a custom 8px bottom border</p>
</body>
</html>

Important Notes

The border-bottom-width property requires border-style to be set. Without a border style, the width has no visual effect:

<!DOCTYPE html>
<html>
<head>
    <style>
        .no-style {
            border-bottom-width: 10px;
            /* No border-style - border won't show */
            padding: 10px;
        }
        .with-style {
            border-bottom-width: 10px;
            border-style: solid;
            border-color: #333;
            padding: 10px;
        }
    </style>
</head>
<body>
    <p class="no-style">No visible border (missing border-style)</p>
    <p class="with-style">Visible border with style defined</p>
</body>
</html>

Common Use Cases

The property is commonly used for:

  • Creating underlines for headings and navigation items
  • Adding visual separation between content sections
  • Styling form inputs and buttons
  • Creating dividers in card layouts

Conclusion

The border-bottom-width property controls the thickness of bottom borders and must be used with border-style. It accepts keyword values (thin, medium, thick) or custom length values for precise control.

Updated on: 2026-03-15T23:18:59+05:30

68 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements