CSS Property: outline-width
[this page | pdf | back links]
The CSS (CSS2) outline-width property sets the width
of an element’s outline (outside the edge or border of the element). Note: an
element needs to have an outline (so you need to set the outline-style
property to something other than none) before the width of the outline can be
set.
Valid property values
(other than inherit
and initial) are:
Default Value:
|
0
|
JavaScript syntax:
|
e.g. object.style.outlineWidth="3px"
|
Inherited:
|
No
|
Animatable:
|
Yes
|
EXAMPLE:
HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head>
<style>
div {width: 100px; height: 15px; border: 1px dotted black; padding: 5px;
outline: 2px dashed blue}
.x1 {outline-width: 5px}
</style>
</head>
<body>
Element with default property<br><br>
<div>abcdefgh</div><br><br>
Property set using in-file HTML style<br><br>
<div class="x1">abcdefgh</div><br><br>
Property set using JavaScript<br><br>
<div id="x2">abcdefgh</div>
<script>
document.getElementById("x2").style.outlineWidth = "5px";
</script>
</body>
</html>
|
FUNCTION THAT MAY ASSIST IN TESTING WHETHER FEATURE IS SUPPORTED:
function isSupportedCSSPropertyOutlineWidth() {
var x = document.createElement("DIV"); x.style.outlineWidth = "5px"; return (window.getComputedStyle(x, null).outlineWidth == "5px");
} |
NAVIGATION LINKS
Contents | Prev | Next | CSS Properties