CSS Property: outline-color
[this page | pdf | back links]
The CSS (CSS2) outline-color property sets the color
of the outline of an element (i.e. a line that is drawn around the element,
outside its borders, usually to make the element stand out relative to other
elements.
Valid property values
(other than inherit
and initial) are:
Value
|
Description
|
color
|
A CSS colour
|
invert
|
(default value). Inverts
colour
|
Default Value:
|
invert
|
JavaScript syntax:
|
e.g. object.style.outlineColor="red"
|
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-color: red}
</style>
</head>
<body>
Element with default property<br>
<div>abcdefgh</div><br><br>
Property set using in-file HTML style<br>
<div class="x1">abcdefgh</div><br><br>
Property set using JavaScript<br>
<div id="x2">abcdefgh</div>
<script>
document.getElementById("x2").style.outlineColor = "red";
</script>
</body>
</html>
|
FUNCTION THAT MAY ASSIST IN TESTING WHETHER FEATURE IS SUPPORTED:
function isSupportedCSSPropertyOutlineColor() {
var x = document.createElement("DIV"); x.style.outlineColor = "red"; return (window.getComputedStyle(x, null).outlineColor == "red");
} |
NAVIGATION LINKS
Contents | Prev | Next | CSS Properties