
- 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
The border Shorthand Property in CSS
The border property is used to define the border properties for an element. It is a shorthand for border-width, border-style and border-color.
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> img { margin-top: 14px; margin-left: 30px; border: 2px solid orange; box-shadow: 0 0 12px 1px black; } #demo { border: 4px dotted magenta; } </style> </head> <body> <img src="https://www.tutorialspoint.com/swing/images/swing-mini-logo.jpg"> <img id="demo" src="https://www.tutorialspoint.com/scala/images/scala-mini-logo.jpg"> </body> </html>
Output
This gives the following output −
Example
<!DOCTYPE html> <html> <head> <style> table { margin: 1em; border: 3px dashed green; } td { font-size: 24px; border: 2px double navy; } </style> </head> <body> <table> <tr> <td>This</td> <td>text</td> </tr> <tr> <td>is</td> <td>demo</td> </tr> </table> </body> </html>
Output
This gives the following output −
- Related Articles
- The Background Shorthand Property in CSS
- The padding shorthand Property in CSS
- The margin Shorthand Property in CSS
- The outline Shorthand Property in CSS
- CSS Animation Shorthand property
- The list-style Shorthand property in CSS
- Shorthand property to set the background in CSS
- Shorthand property to set the font with CSS
- The border-style Property in CSS
- The border-color Property in CSS
- The border-width Property in CSS
- Shorthand property to set columns with CSS
- Animate CSS border property
- CSS border-radius property
- CSS border-image property

Advertisements