Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
CSS outline-style property
The CSS outline-style property specifies the style for the line that goes around an element's border. Unlike borders, outlines don't take up space and don't affect the element's layout.
Syntax
selector {
outline-style: value;
}
Possible Values
| Value | Description |
|---|---|
none |
No outline (default value) |
solid |
Outline is a single solid line |
dotted |
Outline is a series of dots |
dashed |
Outline is a series of short lines |
double |
Outline is two solid lines |
groove |
Outline appears carved into the page |
ridge |
Outline appears raised from the page |
inset |
Outline makes the element look embedded |
outset |
Outline makes the element look raised |
hidden |
Same as none |
Example: Different Outline Styles
The following example demonstrates various outline styles −
<!DOCTYPE html>
<html>
<head>
<style>
.box {
width: 200px;
padding: 15px;
margin: 20px;
background-color: #f0f0f0;
outline-width: 3px;
outline-color: #333;
}
.solid { outline-style: solid; }
.dashed { outline-style: dashed; }
.dotted { outline-style: dotted; }
.double { outline-style: double; }
</style>
</head>
<body>
<div class="box solid">Solid outline</div>
<div class="box dashed">Dashed outline</div>
<div class="box dotted">Dotted outline</div>
<div class="box double">Double outline</div>
</body>
</html>
Four gray boxes appear with different outline styles: - First box has a solid black outline - Second box has a dashed black outline - Third box has a dotted black outline - Fourth box has a double black outline
Conclusion
The outline-style property controls the visual appearance of an element's outline. It must be set for the outline to be visible, and works best when combined with outline-width and outline-color properties.
Advertisements
