
- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Measurement Units
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursors
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS Advanced
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Media Types
- CSS - Paged Media
- CSS - Aural Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS3 Tutorial
- CSS3 - Tutorial
- CSS3 - Rounded Corner
- CSS3 - Border Images
- CSS3 - Multi Background
- CSS3 - Color
- CSS3 - Gradients
- CSS3 - Shadow
- CSS3 - Text
- CSS3 - Web font
- CSS3 - 2d transform
- CSS3 - 3d transform
- CSS3 - Animation
- CSS3 - Multi columns
- CSS3 - User Interface
- CSS3 - Box Sizing
- CSS Responsive
- CSS - Responsive Web Design
- CSS References
- CSS - Questions and Answers
- CSS - Quick Guide
- CSS - References
- CSS - Color References
- CSS - Web browser References
- CSS - Web safe fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
Effect of Color Property on Borders and Outlines in CSS
We can define the border color and outline color for an element. Unlike borders, outline doesn’t take up any space. The border-color property is used to set an element’s border color and the outline-color property is used to set its outline color.
Syntax
The syntax for CSS border-color and outline-color property is as follows −
/*for setting border-color*/ Selector { border-color: /*value*/ } /*for setting outline-color*/ Selector { outline-color: /*value*/ }
The following examples illustrate CSS border-color and outline-color property −
Example
<!DOCTYPE html> <html> <head> <style> span { margin: 15px; padding: 20px; border-style: solid; border-color: limegreen crimson; position: absolute; outline-width: 5px; outline-style: ridge; outline-color: orange; top: 15px; border-radius: 50%; } div { margin: auto; border-style: solid; border-color: darkmagenta dodgerblue; outline-style: dotted; outline-color: black; height: 80px; width: 80px; } </style> </head> <body> <div><span></span></div> </body> </html>
Output
This gives the following output −
Example
<!DOCTYPE html> <html> <head> <style> p { border-width: 5px; border-style: ridge; border-color: lightblue; outline-style: solid; outline-color: darkviolet; } </style> </head> <body> <h2>Exams Timings</h2> <p>Entrance Exam timings 3PM - 5PM. All candidates are requested to report at 2:45PM.</p> </body> </html>
Output
This gives the following output −
- Related Articles
- Outlines Vs Borders in CSS
- Perform Animation on CSS color property
- Set the color of the four borders using CSS
- Usage of color property in CSS
- Perform Animation on CSS border-bottom-color property
- Setting Color Property in CSS
- Usage of background-color property in CSS
- Usage of border-color property in CSS
- Perform Animation on the background-color property with CSS
- CSS outline-color property
- CSS caret-color Property
- The outline-color Property in CSS
- The border-color Property in CSS
- Usage of border-top-color property in CSS
- Usage of border-right-color property in CSS

Advertisements