In CSS, the border property adds a border around an element.
.box { border: 2px solid black; }
The shorthand syntax is:
border: width style color;
Common examples:
/* Solid border */ border: 1px solid #ccc; /* Dashed border */ border: 2px dashed red; /* Dotted border */ border: 3px dotted blue; /* Rounded corners */ border: 1px solid black; border-radius: 8px; /* Only one side */ border-bottom: 1px solid #ddd; border-top: 2px solid black; border-left: 4px solid green; border-right: 1px solid gray; /* Remove border */ border: none;
You can also control the parts separately with border-width, border-style, and border-color.
Comments
Post a Comment