borderTopWidth Property - Javascript CSS Style Property

Javascript examples for CSS Style Property:borderTopWidth


The borderTopWidth property sets or gets the width of the top border.

Property Values

Value Description
thina thin border
medium a medium border. This is default
thick a thick border
length width of the border in length units
initial Sets this property to its default value.
inherit Inherits this property from its parent element.

Technical Details

Item Value
Default Value: medium?
Return Value: A String, representing the width of an element's top border
CSS VersionCSS1

Get the width of the top border of a <div> element

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<div id="myDiv" style="border-top:thick solid red">This is a div element.</div>
<button type="button" onclick="myFunction()">Return the width of the top border</button>

function myFunction() {/* w  w  w.  j a  va  2 s  .  c o  m*/


Related Tutorials