⇧
vadnica-logo
Editor My Blog Password Manager Finance My Services About the Project Telegram O meni O meni

CSS Borders

Borders allow us to define the style, width, and color of an element, properties that determine the boundary of elements. Four values are allowed, specifying the top, bottom, right, and left borders. In practice, this is the border around the HTML element. The border-style property has four values: solid, dashed, dotted, and double, meaning the top border will be solid, the bottom double, the right dashed, and the left dotted. If a border has two or three values, we specify one or more values using properties like border-top-style: solid, border-bottom-style: solid, and so on.

EXAMPLE
RESULT
Property Example Description
Basic Properties
borderborder: 2px solid red; Shorthand property to set width, style, and color at once
border-widthborder-width: 2px; Sets the width of all four borders (top, right, bottom, left)
border-styleborder-style: solid; Sets the style of the border (solid, dashed, dotted, double, groove, ridge, inset, outset, none, hidden)
border-colorborder-color: red; Sets the color of all four borders
Individual Sides (Top, Right, Bottom, Left)
border-topborder-top: 1px solid black; Sets the top border (width, style, color)
border-rightborder-right: 2px dashed blue; Sets the right border
border-bottomborder-bottom: 3px dotted green; Sets the bottom border
border-leftborder-left: 1px solid red; Sets the left border
Individual Properties per Side
border-top-widthborder-top-width: 2px; Width of the top border only
border-top-styleborder-top-style: dashed; Style of the top border only
border-top-colorborder-top-color: red; Color of the top border only
Rounded Corners
border-radiusborder-radius: 10px; Rounds all four corners
border-top-left-radiusborder-top-left-radius: 5px; Rounds the top-left corner
border-top-right-radiusborder-top-right-radius: 5px; Rounds the top-right corner
border-bottom-left-radiusborder-bottom-left-radius: 5px; Rounds the bottom-left corner
border-bottom-right-radiusborder-bottom-right-radius: 5px; Rounds the bottom-right corner
Other
outlineoutline: 2px solid red; Border outside the element border (does not affect layout)
outline-offsetoutline-offset: 4px; Space between the outline and the border