Borders are used to create visual boundaries around elements.
.element { border-width: 2px; border-style: solid; border-color: #333; } /* Shorthand property */ .element { border: 2px solid #333; }
.solid-border { border: 2px solid #000; } .dashed-border { border: 2px dashed #666; } .dotted-border { border: 2px dotted #999; } .double-border { border: 3px double #333; }
.element { border-top: 2px solid red; border-right: 2px solid blue; border-bottom: 2px solid green; border-left: 2px solid yellow; }
.rounded { border-radius: 10px; } .circle { border-radius: 50%; width: 100px; height: 100px; } .different-corners { border-radius: 10px 20px 30px 40px; /* top-left top-right bottom-right bottom-left */ }
.gradient-border { border: 3px solid; border-image: linear-gradient(45deg, red, blue, green); border-image-slice: 1; }
.outline-example { border: 2px solid blue; outline: 2px solid red; /* Outline doesn't affect layout */ /* Border affects box model */ }
.card { border: 1px solid #e1e5e9; border-radius: 8px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
.button { border: 2px solid #007bff; border-radius: 4px; background-color: #007bff; color: white; padding: 8px 16px; }