❯
Tutorials References Exercises Certificates Search... Upgrade Get Certified
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY
CSS HOME ADVERTISEMENT
CSS Introduction
CSS Syntax
CSS Selectors
CSS How To
CSS Comments
CSS Errors
CSS Shorthand Border Property
CSS Colors ❮ Previous Next ❯
CSS Backgrounds
CSS Borders
Borders
Border Width CSS Border - Shorthand Property
Border Color
Border Sides Like you saw in the previous page, there are many properties to consider when dealing with borders.
Border Shorthand
Rounded Borders To shorten the code, it is also possible to specify all the individual border properties in one property.
CSS Margins The border property is a shorthand property for the following individual border properties:
CSS Padding
CSS Height/Width border-width
CSS Box Model border-style (required)
CSS Outline border-color
CSS Text
CSS Fonts
CSS Icons Example
CSS Links
CSS Lists p {
CSS Tables border: 5px solid red;
CSS Display }
CSS Max-width
CSS Position Result: ❯
Tutorials References Exercises Certificates Upgrade Get Certified
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY
Some text
CSS HOME
CSS Introduction
CSS Syntax Try it Yourself »
CSS Selectors
CSS How To
CSS Comments You can also specify all the individual border properties for just one side:
CSS Errors
CSS Colors
CSS Backgrounds Left Border
CSS Borders COLOR
Borders p { PICKER
Border Width border-left: 6px solid red;
}
Border Color
Border Sides
Result:
Border Shorthand
Rounded Borders
CSS Margins Some text
CSS Padding
CSS Height/Width
CSS Box Model Try it Yourself »
CSS Outline
CSS Text
CSS Fonts
CSS Icons
Bottom Border
CSS Links
CSS Lists p {
CSS Tables border-bottom: 6px solid red;
CSS Display }
CSS Max-width
CSS Position Result: ❯
Tutorials References Exercises Certificates Upgrade Get Certified
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY
Some text
CSS HOME
CSS Introduction
CSS Syntax Try it Yourself »
CSS Selectors
CSS How To
CSS Comments
CSS Errors
CSS Colors ?
CSS Backgrounds
Exercise
CSS Borders Drag and drop the correct values to set the border as 5px, solid, and green.
Borders
Border Width
p {
Border Color
Border Sides border: ;
Border Shorthand }
Rounded Borders
CSS Margins solid 5px green dotted
CSS Padding
CSS Height/Width
CSS Box Model
Submit Answer »
CSS Outline
CSS Text
CSS Fonts
CSS Icons
CSS Links
CSS Lists ❮ Previous Next ❯
CSS Tables
CSS Display
CSS Max-width
CSS Position ❯
Tutorials References Exercises Certificates Upgrade Get Certified
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY
CSS HOME
CSS Introduction ADVERTISEMENT
CSS Syntax ADVERTISEMENT
CSS Selectors
CSS How To
CSS Comments
CSS Errors
CSS Colors
CSS Backgrounds
CSS Borders
Borders
PLUS SPACES GET CERTIFIED FOR TEACHERS
Border Width
Border Color
Border Sides FOR BUSINESS CONTACT US
Border Shorthand
Rounded Borders
Top Tutorials Top References Top Examples
CSS Margins
CSS Padding HTML Tutorial HTML Reference HTML Examples
CSS Tutorial CSS Reference CSS Examples
CSS Height/Width JavaScript Tutorial JavaScript Reference JavaScript Examples
How To Tutorial SQL Reference How To Examples
CSS Box Model SQL Tutorial Python Reference SQL Examples
CSS Outline Python Tutorial W3.CSS Reference Python Examples
Tutorial
W3.CSS Bootstrap Reference W3.CSS Examples
CSS Text Bootstrap
Tutorial PHP Reference Bootstrap Examples
PHP Tutorial HTML Colors PHP Examples
CSS Fonts Tutorial
Java Java Reference Java Examples
C++ Tutorial Angular Reference XML Examples
CSS Icons
jQuery Tutorial jQuery Reference jQuery Examples
CSS Links
Get Certified
CSS Lists
HTML Certificate
CSS Tables Certificate
CSS
CSS Display JavaScript Certificate
Front End Certificate
CSS Max-width SQL Certificate
Python Certificate
CSS Position ❯
Tutorials PHP Certificate
References
jQuery Certificate
Exercises Certificates Upgrade Get Certified
Java Certificate
HTML CSS C++ CertificateSQL
JAVASCRIPT PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY
C# Certificate
XML Certificate
CSS HOME
CSS Introduction
CSS Syntax
CSS Selectors FORUM ABOUT ACADEMY
CSS How To W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning.
Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness
CSS Comments of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.
CSS Errors Copyright 1999-2025 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.
CSS Colors
CSS Backgrounds
CSS Borders
Borders
Border Width
Border Color
Border Sides
Border Shorthand
Rounded Borders
CSS Margins
CSS Padding
CSS Height/Width
CSS Box Model
CSS Outline
CSS Text
CSS Fonts
CSS Icons
CSS Links
CSS Lists
CSS Tables
CSS Display
CSS Max-width