CSS Property: outline-offset
[this page | pdf | back links]
The CSS (CSS2) outline-offset property sets the amount
of space between an element’s outline and the edge or border of the element.
Valid property values
(other than inherit
and initial) are:
Default Value:
|
0
|
JavaScript syntax:
|
e.g. object.style.outlineOffset="10px"
|
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 solid blue}
.x1 {outline-offset: 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.outlineOffset = "5px";
</script>
</body>
</html>
|
FUNCTION THAT MAY ASSIST IN TESTING WHETHER FEATURE IS SUPPORTED:
function isSupportedCSSPropertyOutlineOffset() {
var x = document.createElement("DIV"); x.style.outlineOffset = "5px"; return (window.getComputedStyle(x, null).outlineOffset == "5px");
} |
NAVIGATION LINKS
Contents | Prev | Next | CSS Properties