w1coding.comAll tutorials

CSS Borders

CSS lessons
  1. Environment Setup
  2. Introduction
  3. Tdisplay
  4. Basics
  5. Editors
  6. Syntax
  7. Colors
  8. Background
  9. Borders
  10. Margins
  11. Padding
  12. Width And Height
  13. Outline
  14. Texts
  15. Fonts
  16. Icons
  17. Links
  18. Lists
  19. Display
  20. Tables
  21. Max And With
  22. Positon
  23. Z Index
  24. Dropdown
  25. Overflow
  26. Float
  27. Navigation
  28. Image Sprites

CSS Border Properties

Basic Border

The border property is a shorthand for setting the width, style, and color of a border in one line.

Example of Basic Border: 2px solid #3498db

Border Color

The border-color property sets the color of the border. You can specify a color for all sides or set a different color for each side.

Example of Border Color: #e74c3c

Border Radius

The border-radius property creates rounded corners. You can specify the radius for all corners or set different values for each corner.

Example of Border Radius: 10px

Border Styles

The border-style property defines the style of the border. Common styles include solid, dashed, dotted, and double.

Example of Dashed Border
Example of Double Border

Individual Border Sides

CSS allows you to set borders individually on each side (top, right, bottom, left). For example, you can use border-top, border-right, etc.

Example of Top Border Only

Combining Border Properties

When setting borders, you can combine border-width, border-style, and border-color in a shorthand property like this:

border: 3px dotted #3498db;