Easy Tutorial
❮ Jsref Splice Met Console Warn ❯

Style border Property


Definition and Usage

The border property sets or returns three individual border properties in a shorthand form.

Using this property, you can set/return:

Syntax

Set the border property:

Return the border property:

Tip: The border property has no default value.

Parameter Description
width Sets the width of the border.
style Sets the style of the border.
color Sets the color of the border.

Browser Support

All major browsers support the border property.


Example

Change the border of a div element:

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>tutorialpro.org(tutorialpro.org)</title> 
<style type="text/css">
#ex1{
    border: thin dotted #FF0000;
}
</style>
<script>
function displayResult(){
    document.getElementById("ex1").style.border="thick solid #0000FF";
}
</script>
</head>
<body>

<div id="ex1">This is some text.</div>
<br>
<button type="button" onclick="displayResult()">Modify Border</button>

</body>
</html>

❮ Jsref Splice Met Console Warn ❯