border-bottom-width

CSS border-bottom-width Property

The border-bottom-width property sets the width of the bottom border.

You need to set the border-style or the border-bottom-style property before the border-bottom-width property. First you need to have borders before you can change the width.

The specification doesn’t set the exact thickness set by each keyword, the precise result when using one of them is implementation-specific. But they always follow the pattern thin ≤ medium ≤ thick, and the values are constant within a single document.

类目类目
Initial Valuemedium
Applies toAll elements. It also applies to ::first-letter.
InheritedNo.
AnimatableYes. The width can be animatable.
VersionCSS1
DOM Syntaxobject.style.borderBottomWidth = “5px”;

Syntax

Syntax

border-bottom-width: medium | thin | thick | length | initial | inherit;

Example of the border-bottom-width property:

<!DOCTYPE html>
<html>
  <head>
    <style>
      p {
        border-style: dotted;
        border-bottom-width: thick;
      }
    </style>
  </head>
  <body>
    <p>
      As you can see, we used border-bottom-width property to set the width of bottom border of this element.
    </p>
  </body>
</html>

Result

Example of the border-bottom-width property with the “medium” value:

<!DOCTYPE html>
<html>
  <head>
    <title>The title of the document</title>
    <style>
      h2 {
        border-bottom-style: groove;
        border-bottom-width: medium;
      }
      div {
        border-style: groove;
        border-bottom-width: medium;
      }
    </style>
  </head>
  <body>
    <h2>A heading with a medium bottom border.</h2>
    <div>A div element with a medium bottom border.</div>
  </body>
</html>

Example of the border-bottom-width property that shows the difference between the “thin” and “thick values:

<!DOCTYPE html>
<html>
  <head>
    <title>The title of the document</title>
    <style>
      h2 {
        padding: 5px;
        border-bottom-style: ridge;
        border-bottom-width: thin;
        border-color: #cccccc;
      }
      div {
        padding: 5px;
        border-style: ridge;
        border-bottom-width: thick;
      }
    </style>
  </head>
  <body>
    <h2>A heading with thin bottom border</h2>
    <div>A div element with thick bottom border.</div>
  </body>
</html>

Values

Values

ValueDescriptionPlay it
mediumSets a medium bottom border. It is the default value.Play it »
thinSets a thin bottom border.Play it »
thickSets a thick bottom border.Play it »
lengthWith the help of this you can set the thickness of the bottom border.Play it »
initialSets the property to its default value.Play it »
inheritInherits the property from its parent element.


请遵守《互联网环境法规》文明发言,欢迎讨论问题
扫码反馈

扫一扫,反馈当前页面

咨询反馈
扫码关注
返回顶部