Javascript examples for CSS Style Property:outline
The outline property sets or gets all the outline properties in a shorthand form:
The outline is not a part of the element's dimensions.
Parameter | Description |
---|---|
width | Sets the width of the outline |
style | Sets the style of the outline |
color | Sets the color of the outline |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
Item | Value |
---|---|
Default Value: | medium none invert |
Return Value: | A String, representing the outline width, style and/or color of an element |
CSS Version | CSS2 |
Add an outline around a <div> element:
<!DOCTYPE html> <html> <head> <style> #myDiv {/*from w ww . j a v a 2 s .co m*/ border: 1px solid red; outline: dotted green; } </style> </head> <body> <div id="myDiv" style="outline-width:10px;">This is a div element.</div> <br> <button type="button" onclick="myFunction()">Return outline width</button> <script> function myFunction() { document.getElementById("myDiv").style.outline = '5px dotted green'; } </script> </body> </html>