
- 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
CSS Border Properties
The CSS border property is used to define the border properties for an element. It is a shorthand for border-width, border-style and border-color. We can style individual sides using side-specific properties like border-top, border-right, etc.
Syntax
The syntax of CSS border property is as follows −
Selector { border: /*value*/ }
Example
The following examples illustrate CSS border property −
<!DOCTYPE html> <html> <head> <style> div { border-style: solid; margin: auto; padding: 5px; border-radius: 50%; } #main { height: 100px; width: 100px; border-left: 12px ridge goldenrod; border-right: 12px ridge goldenrod; } #main > div { line-height: 12px; height: 30px; width: 10px; padding: 27px 20px; border-top: 6px groove crimson; border-bottom: 6px ridge crimson; } </style> </head> <body> <div id="main"> <div>i see you</div> </div> </body> </html>
Output
This gives the following output −
Example
<!DOCTYPE html> <html> <head> <style> p { width: 60%; margin: auto; padding: 20px 45px; border-top-width: 1.4em; border-top-style: solid; border-top-color: violet; border-radius: 85px 85px 0 0; color: black; font-size: 1.3em; background-image: url("https://www.tutorialspoint.com/images/css.png"); } </style> </head> <body> <p>CSS is used to control the style of a web document in a simple way. It handles the look and feel part of a web page.</p> </body> </html>
Output
This gives the following output −
- Related Articles
- Set all border-radius properties with CSS
- Set all the top border properties in one declaration using CSS
- CSS Background Properties
- CSS Dimension Properties
- CSS Margin Properties
- Difference between CSS border-collapse:collapse; and border-collapse:separate;
- CSS border-image property
- CSS border-image-slice
- CSS border-image-source
- CSS border-image-width
- CSS border-image-repeat
- CSS border-box Value
- CSS border-radius property
- Animate CSS border property
- Aural Media CSS Properties

Advertisements