

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
The outline Shorthand Property in CSS
The outline shorthand property can be defined to draw a line of specific style (required), thickness, and color 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 Shorthand property is as follows −
Selector { outline: /*value*/ }
Example
Let’s see an example of outline Shorthand property −
<!DOCTYPE html> <html> <head> <title>CSS outline Shorthand</title> <style> span { margin: 15px; padding: 20px; border-style: solid; border-color: #f28500 #dc3545; position: absolute; outline: 5px double green; border-radius: 50%; } #showDiv { margin:auto; border-style: solid; border-color: darkmagenta dodgerblue; outline: groove 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>
Output
Following is the output for the above code −
Example
Let’s see another example of outline Shorthand property −
<!DOCTYPE html> <html> <head> <title>CSS outline Shorthand</title> <style> #container { width:50%; margin:50px auto; } p { margin:auto; border-style: ridge; border-width: 10px; border-color: orange; outline: 5px dashed yellow; } </style> </head> <body> <div id="container"> <p>Coding Ground is loved by millions of programmers around the globe.</p> </div> </body> </html>
Output
Following is the output for the above code −
- Related Questions & Answers
- The padding shorthand Property in CSS
- The Background Shorthand Property in CSS
- The margin Shorthand Property in CSS
- The border Shorthand Property in CSS
- CSS Animation Shorthand property
- CSS outline property
- The list-style Shorthand property in CSS
- The outline-width Property in CSS
- The outline-style Property in CSS
- The outline-color Property in CSS
- CSS outline-style property
- CSS outline-color property
- CSS outline-width property
- Shorthand property to set the background in CSS
- Shorthand property to set the font with CSS
Advertisements