Notes: The table contains most common CSS properties/values. The browsers might ignore some of the properties!
Most off the properties have 'initial', 'unset' and 'inherit' values:
Property | Value | Description | Comments |
---|---|---|---|
Margin properties | |||
margin
margin-top margin-right margin-bottom margin-left |
[length] | [percentage] | auto {1, 4} | A shorthand property for setting the margin properties in one declaration | The four box parts (top, right, bottom, left) can be set to different margins in this declaration:
p { margin: 1px auto 2px 10px; } You can use also margin-top, margin-right, margin-bottom, margin-left to set separate edges. The margins are completely transparent - and cannot have a background color! A percentage is relative to the width of the containing block. Negative values are allowed. |
Padding properties | |||
padding
padding-top padding-right padding-bottom padding-left |
[length] | [percentage] {1, 4} | A shorthand property for setting the padding properties in one declaration | The four box parts (top, right, bottom, left) can be set to different margins in this declaration:
p { padding: 1px auto 2px 10px; } You can use also padding-top, padding-right, padding-bottom, padding-left to set separate edges. Percentage - with respect to the width of the containing block. |
Special properties | |||
box-sizing | content-box | padding-box | border-box | Is used to calculate widths and heights of elements | |
box-shadow | [offset-x] [offset-y] [blur-radius] [color]| none | Adds shadows to the box | Each shadow is specified as an offset from the box, along with optional color and blur radius values.
Offsets and blur-radius are in [length] values. See MDN Box Shadow Generator |
overflow
overflow-x overflow-y |
visible | hidden | scroll | auto | Specifies whether to clip content, render scrollbars or just display content when it overflows its block level container | Overflow (without a/y specification) applies to bot x and y |
vertical-align | [length] | [percentage] | baseline | sub | super | top | text-top | middle | bottom | text-bottom | Specifies the vertical alignment of an inline box or text, or table cell. | Negative values are allowed for [length] and [percentage]. Important: add vertical-align when working with sidplay rqual to inline-block |
visibility | visible | hidden | collapse | Is used to hide an element while leaving the space where it would have been | Collapse is for table rows/columns. Collapse removes a row or column, but it does not affect the table layout. The space taken up by the row or column will be available for other content. |
display | none | inline | block | ... | Specifies the type of rendering box used for an element. | None: Turns off the display of an element (it has no effect on layout); all descendant elements also have their display turned off. The document is rendered as though the element did not exist. To render an element box's dimensions, yet have its contents be invisible, see the visibility property. |
Size | |||
width | [length] | [percentage] | min-content | max-content | fit-content | auto | Specifies the width of the content area of an element | Includes padding if box-sizing is border-box |
height | [length] | [percentage] | Specifies the height of the content area of an element | Includes padding if box-sizing is border-box |
min-width | [length] | [percentage] | Specifies the minimum width of a box | |
min-height | [length] | [percentage] | Specifies the minimum height of a box | |
max-width | [length] | [percentage] | Specifies the maximum width of a box | max-width overrides width, but min-width overrides max-width. Using max-width instead of width, may improve the browser's handling of small windows. |
max-height | [length] | [percentage] | Specifies the maximum wiheightdth of a box |