Skip to content

Borders

In CSS, borders define the appearance of an element’s outline.
Here is a summary of currently valid properties and another for deprecated ones.


PropertyDescription
borderDefines all border characteristics (style, color, width).
border-top / border-right / border-bottom / border-leftBorders specific to each side.
border-colorDefines the border color.
border-styleDefines the border style (solid, dotted, dashed, etc.).
border-widthDefines the border thickness.
border-radiusDefines rounded corners.
border-imageDefines an image as the border.
border-collapseDefines how table cell borders are displayed (for tables).
border-spacingDefines the space between two table cells (only if border-collapse: separate).
outlineDefines an outline around the element (different from a border).
outline-color / outline-style / outline-widthVariants of outline.
box-shadowDefines a shadow around an element.

These properties were used before standardization, or remain supported only in certain browsers (mainly Safari / older Firefox).
They should only be used for compatibility with very old browsers.

PropertyStatusExplanation
-moz-border-radius (and variants -topleft, -bottomright…)DeprecatedOld prefix for border-radius (before standardization in Firefox).
-webkit-border-radius (and variants)DeprecatedOld prefix for border-radius (Chrome/Safari).
-webkit-border-image-*DeprecatedOld prefix for border-image.
-moz-outline-*DeprecatedOld experimental implementation of outline.
-webkit-box-shadowDeprecatedOld prefix for box-shadow.
-webkit-text-strokeSpecificStill used in Safari/Chrome to apply text stroke, but not standardized.
-webkit-box-reflectSafari-specificCreates a reflection effect below an element (non-standard, WebKit-only).

  • Always use standard properties (border-radius, box-shadow, outline, etc.).
  • Prefixed versions -moz- and -webkit- are only useful if you need to support very old browsers.
  • Some properties (-webkit-text-stroke, -webkit-box-reflect) are Safari proprietary and have no standardized equivalent.

.my-box {
border: 2px solid #333;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}