• Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
  • Skip to footer

Computer Notes

Library
    • Computer Fundamental
    • Computer Memory
    • DBMS Tutorial
    • Operating System
    • Computer Networking
    • C Programming
    • C++ Programming
    • Java Programming
    • C# Programming
    • SQL Tutorial
    • Management Tutorial
    • Computer Graphics
    • Compiler Design
    • Style Sheet
    • JavaScript Tutorial
    • Html Tutorial
    • Wordpress Tutorial
    • Python Tutorial
    • PHP Tutorial
    • JSP Tutorial
    • AngularJS Tutorial
    • Data Structures
    • E Commerce Tutorial
    • Visual Basic
    • Structs2 Tutorial
    • Digital Electronics
    • Internet Terms
    • Servlet Tutorial
    • Software Engineering
    • Interviews Questions
    • Basic Terms
    • Troubleshooting
Menu

Header Right

Home » Css » Tutorial » CSS border-style property
Next →
← Prev

CSS border-style property

By Dinesh Thakur

The Border properties are used to set the border of an element i.e. its width, color and style.

We’ll be covering the following topics in this tutorial:

  • CSS Border-Style
  • CSS Border-Width
  • CSS Border-Color
  • CSS Border

CSS Border-Style

The BORDER-STYLE property is used to specify the style of the border. The possible values are None (default), Dotted, Dashed, Solid, Double, Groove, Ridge, Inset, Outset and Hidden. For example:

p{border-style : dotted;}

You can also apply styles to each side of the border using BORDER-TOP-STYLE, BORDER-BOTTOM-STYLE, BORDER-LEFT-STYLE and BORDER-RIGHT-STYLE properties.

You can also specify individual styles of each side of border using BORDER-STYLE property at the same place. The values that appear in the border-style are in the order of Top, Right, Bottom, Left values. For example:

p{border-style : solid dashed solid dotted;}

CSS Border-Width

The BORDER-WIDTH property is used to specify the width of the border. The possible values that can be assigned to it are Thin, Medium, Thick or in terms of length. You cannot specify it in terms of percentage. For example:

p{border-style : solid;  Border-Width : 10px;  }

You can also apply border-width for top, bottom, right and left sides of the border using BORDER-TOP-WIDTH, BORDER-BOTTOM-WIDTH, BORDER-RIGHT-WIDTH and BORDER-LEFT-WIDTH properties respectively. For example:

p{border-style:solid; border-right-width:20px;}

You can also specify individual width of each side of border using BORDER-WIDTH style property at the same place. The values that appear in it are in the order of their top, right, bottom and left side width values. For example:

p{border-style : solid;  Border-Width : 10px 20px 15px 5px;}

CSS Border-Color

The BORDER-COLOR property is used to specify the color of the border surrounding the element. Its values can be specified using color names, hexadecimal representation, rgb representation or shorthand hexadecimal notation. For example:

p{border-style : solid;  Border-Color: red;  }

As box consists of four borders top, bottom, left and right so you can set their color; individually using BORDER-TOP-COLOR, BORDER-BOTTOM-COLOR, BORDER-LEFT-COLOR and BORDER-RIGHT-COLOR properties respectively. For example:

p{border-style : solid;  
Border-Left-Color: blue;  
Border-Right-Color : green;  }

CSS Border

The BORDER property is a shorthand property in witch you can specify width, style and color in the order BORDER-WIDTH, BORDER-STYLE, and BORDER-COLOR. For example

P{border: 1px solid blue ;} 

You can also set the width, style and color for each side of the border individually in a single statement. In order to set the properties for left side we use BORDER-LEFT. For example

P{border-left : 1px solid blue ;}

Similarly you can set the width, style and color for right, top and bottom sides using BORDER· RIGHT, BORDER-TOP, BORDER-BOTTOM properties respectively.

You’ll also like:

  1. CSS margin property
  2. CSS font property
  3. CSS position property
  4. CSS padding property
  5. CSS background property
Next →
← Prev
Like/Subscribe us for latest updates     

About Dinesh Thakur
Dinesh ThakurDinesh Thakur holds an B.C.A, MCDBA, MCSD certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps.

Dinesh Thakur is a Freelance Writer who helps different clients from all over the globe. Dinesh has written over 500+ blogs, 30+ eBooks, and 10000+ Posts for all types of clients.


For any type of query or something that you think is missing, please feel free to Contact us.


Primary Sidebar

CSS Tutorials

CSS Tutorials

  • CSS - Font Property
  • CSS - Background Property
  • CSS - CSS - Border-Style Property
  • CSS - Text-Decoration Property
  • CSS - Tables
  • CSS - Position
  • CSS - Syntax and Selectors
  • CSS - List
  • CSS - Margin
  • CSS - Padding

Other Links

  • CSS Tutorials - PDF Version

Footer

Basic Course

  • Computer Fundamental
  • Computer Networking
  • Operating System
  • Database System
  • Computer Graphics
  • Management System
  • Software Engineering
  • Digital Electronics
  • Electronic Commerce
  • Compiler Design
  • Troubleshooting

Programming

  • Java Programming
  • Structured Query (SQL)
  • C Programming
  • C++ Programming
  • Visual Basic
  • Data Structures
  • Struts 2
  • Java Servlet
  • C# Programming
  • Basic Terms
  • Interviews

World Wide Web

  • Internet
  • Java Script
  • HTML Language
  • Cascading Style Sheet
  • Java Server Pages
  • Wordpress
  • PHP
  • Python Tutorial
  • AngularJS
  • Troubleshooting

 About Us |  Contact Us |  FAQ

Dinesh Thakur is a Technology Columinist and founder of Computer Notes.

Copyright © 2025. All Rights Reserved.

APPLY FOR ONLINE JOB IN BIGGEST CRYPTO COMPANIES
APPLY NOW