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
The outline-style Property in CSS
The outline-style property can be defined to draw a line around the borders of the element, but the outline is not a part of element?s dimensions unlike border property.
Syntax
The syntax of CSS outline-style property is as follows −
Selector {
outline-style: /*value*/
}
The value can be any of the following −
dotted− Set a dotted border
dashed− Set a dashed border
solid− Set a solid border
double− Set a double border
groove− Set a 3D grooved border
ridge− Set a 3D ridged border
inset− Set a 3D inset border
Groove and double outline style
Let?s see an example for the outline-style property. We have set a groove and double outline here using the groove and double values respectively −
outline-style: double; outline-style: groove;
Example
Here is the example −
<!DOCTYPE html>
<html>
<head>
<title>CSS outline-style</title>
<style>
span {
margin: 15px;
padding: 20px;
border-style: solid;
border-color: #dc3545;
position: absolute;
outline-width: 5px;
outline-style: double;
outline-color: orange;
border-radius: 50%;
}
#showDiv {
margin:auto;
border-style: solid;
border-color: darkmagenta dodgerblue;
outline-style: groove;
outline-color: black;
height: 80px;
width: 80px;
}
#container {
width:50%;
margin:50px auto;
}
</style>
</head>
<body>
<div id="container">
<div id="showDiv"><span></span></div>
</div>
</body>
</html>
Dashed outline style
Let?s see an example for the outline-style property. We have set a dashed outline here using the dashed value respectively −
outline-style: dashed;
Example
Here is the example −
<!DOCTYPE html>
<html>
<head>
<title>CSS outline-style</title>
<style>
#container {
width:50%;
margin:50px auto;
}
p {
margin:auto;
border-style: ridge;
border-width: 10px;
border-color: lightblue;
outline-style: dashed;
outline-color: violet;
}
</style>
</head>
<body>
<div id="container">
<p>Video Tutorials helps in understanding the technology with live running examples and practical implementation.</p>
</div>
</body>
</html>
Dotted outline style
Let?s see an example for the outline-style property. We have set a dotted outline here using the dotted value respectively −
outline-style: dotted;
Example
Here is the example −
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
outline-style: dotted;
outline-color: rgb(71, 30, 255);
border: 2px solid yellow;
}
h2 {
outline-style: dotted;
outline-color: rgb(168, 60, 10);
}
</style>
</head>
<body>
<h1>Demo Heading1</h1>
<h2>Demo Heading2</h2>
<p>Demo Text</p>
</body>
</html>
