/

HTML / CSS / JavaScript Tutorial

CSS Property: outline-style

[this page | pdf | back links]

The CSS (CSS2) outline-style property specifies the style to be used for the outline of an element.

 

Valid property values (other than inherit and initial) are:

 

Value

Description

dashed

Dashed outline

dotted

Dotted outline

double

Double outline

groove

Effect depends on outline-color value

hidden

Hidden outline

inset

Effect depends on outline-color value

none

(default value). No outline

outset

Effect depends on outline-color value

ridge

Effect depends on outline-color value

solid

Solid outline

 

Default Value:

none

JavaScript syntax:

e.g. object.style.outlineStyle="ridge"

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-style: dashed}
</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.outlineStyle = "dashed";
</script>

</body>
</html>

FUNCTION THAT MAY ASSIST IN TESTING WHETHER FEATURE IS SUPPORTED:
function isSupportedCSSPropertyOutlineStyle() {
  var x = document.createElement("DIV"); x.style.outlineStyle = "dashed"; return (window.getComputedStyle(x, null).outlineStyle == "dashed");
}


NAVIGATION LINKS
Contents | Prev | Next | CSS Properties


Desktop view | Switch to Mobile