CSS Portal

CSS border-bottom Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The border-bottom CSS property targets only the bottom edge of an element's box, allowing you to draw, style, or remove the line that sits under an element without affecting the other three edges. Because it is edge-specific, it is commonly used for visual separators (for example, underlining headings or list items) and for subtle interface cues such as focus indicators or dividing lines in layouts. Conceptually it is part of the element's border layer in the box model, so it is painted with the rest of the border and can be combined with background and foreground visuals to achieve the intended effect.

This property interoperates with the broader border system: the shorthand border can override edge-specific settings, and the edge's appearance is determined by the combination of the corresponding border-style, border-width, and border-color values for that edge. Because those constituent properties govern style, thickness, and color respectively, controlling them separately or via shorthand gives you precise control over how the bottom edge is rendered relative to the rest of the element. Note that border properties do not inherit from parent elements; they apply to each element independently.

In layout terms, the bottom border participates in the element's box sizing and painting order. Whether that border increases the element's outer footprint or is accounted for inside the declared size depends on box-sizing and how you size the element. Rounded corners and clipping can affect how a bottom border appears at a corner; the interaction with corner shaping is governed by border-radius, which can trim or round the border at the join points. For cases where you want a decorative line that sits outside normal layout flow or doesn't change element geometry, the separate outline property or pseudo-elements are often used instead.

Beyond simple static lines, the bottom border is frequently used as a visual target for transitions and animations (for example animating visibility or thickness changes) or for creating underlines that appear on hover/focus. It also plays a role when using image-based decorations via border-image, where the image can replace or augment the drawn bottom edge. Because the bottom border is a discrete, controllable element of the rendering stack, it gives designers a flexible and performant way to add horizontal delineation and emphasis without additional markup.

Definition

Initial value
See individual properties
Applies to
All elements
Inherited
No
Computed value
See individual properties
Animatable
Yes
JavaScript syntax
object.style.borderBottom

Interactive Demo

The rusty swing set creaked a lonely lullaby in the twilight, shadows lengthening like grasping fingers across the dew-kissed grass. A lone dandelion seed, adrift on the breeze, whispered secrets of faraway fields, of dandelion suns and galaxies spun from fluff. Somewhere, beyond the veil of dusk, a coyote laughed, echoing through the stillness like a forgotten memory.

Syntax

border-bottom: <line-width> || <line-style> || <color>

Values

Example

<body>
<main class='demo'>
<h1>border-bottom examples</h1>

<section>
<h2 class='underline'>Solid underline</h2>
<p class='note'>This heading uses border-bottom: 3px solid #3498db;</p>
</section>

<section>
<h2 class='dashed'>Dashed underline</h2>
<p class='note'>This heading uses border-bottom: 2px dashed #e74c3c;</p>
</section>

<section>
<h2 class='double'>Double underline</h2>
<p class='note'>This heading uses border-bottom: 6px double #2ecc71;</p>
</section>
</main>
</body>
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  padding: 32px;
  background: #f7f9fc;
  color: #222;
}

.demo {
  max-width: 720px;
  margin: 0 auto;
}

h1 {
  margin-bottom: 24px;
  font-size: 1.5rem;
}

section {
  margin-bottom: 20px;
}

h2 {
  font-size: 1.25rem;
  margin: 0 0 6px 0;
  display: inline-block;
}

.underline {
  border-bottom: 3px solid #3498db;
  padding-bottom: 6px;
}

.dashed {
  border-bottom: 2px dashed #e74c3c;
  padding-bottom: 4px;
}

.double {
  border-bottom: 6px double #2ecc71;
  padding-bottom: 8px;
}

.note {
  margin: 0;
  color: #555;
  font-size: 0.95rem;
}

Browser Support

The following information will show you the current browser support for the CSS border-bottom property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!