/

HTML / CSS / JavaScript Tutorial

CSS Property: border-bottom

[this page | pdf | back links]

The CSS (CSS1) border-bottom property is a shorthand property combining all the main bottom border properties.

 

Valid property values (other than inherit or initial) are defined by the elements of the shorthand and are:

 

-        border-bottom-width

-        border-bottom-style

-        border-bottom-color

 

Missing properties are given their default values.

 

Default Value:

medium none color

JavaScript syntax:

e.g. object.style.borderBottom="2px solid red"

Inherited:

No

Animatable:

Yes

 

In the default value, color is the CSS colour of the element.

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head>
<style>
p {width: 200px}
p.x1 {border-bottom: thin solid red;}
</style>
</head>
<body>
<p>1. Element with default property</p>
<p class="x1">2. Element set using in-file HTML style</p>
<p id="x2">3. Element set using JavaScript</p>

<script>
document.getElementById("x2").style.borderBottom = "thin solid red";
</script>

</body>
</html>

FUNCTION THAT MAY ASSIST IN TESTING WHETHER FEATURE IS SUPPORTED:
function isSupportedCSSPropertyBorderBottom() {
  var x = document.createElement("DIV"); x.style.borderBottom = "thin solid red"; return (window.getComputedStyle(x, null).borderBottom == "thin solid red");
}


NAVIGATION LINKS
Contents | Prev | Next | CSS Properties


Desktop view | Switch to Mobile