References : Style sheets
Each element of the document tree is laid out and formatted according to a visual formatting model. The following properties relate to element borders and their spacing.
border |
border-bottom, border-left, border-right, border-top
|
border-color |
border-bottom-color, border-left-color, border-right-color, border-top-color
|
border-style |
border-bottom-style, border-left-style, border-right-style, border-top-style
|
border-width
|
border-bottom-width, border-left-width, border-right-width, border-top-width
|
clear |
height, width |
margin
|
margin-bottom, margin-left, margin-right, margin-top
|
max-height, max-width |
min-height, min-width
|
padding |
padding-top, padding-right, padding-bottom, padding-left
| border |
|
|
| Defines the same width, colour and style for all four borders of an element's box. |
| |
| CSS1 value | ['border-width' || 'border-style' | <color>] |
| |
| CSS2 value | inherit |
| |
| Initial value | Not defined (grouping of properties). |
| |
| Applied to | All elements. |
| |
| Inherited | No. |
| |
| Notes | This property accepts only one value. To define each border of the box with a different value, use the border-width, border-style, or border-color properties. |
| |
Top |
|
| border-bottom, border-left, border-right, border-top |
|
|
| Group the width, style and colour properties for the bottom, left, right and top borders of an element. |
| |
| CSS1 value | ['border-bottom-width' || 'border-style' || <color>]<RL>['border-left-width' || 'border-style' || <color>]<RL>['border-right-width' || 'border-style' || <color>]<RL>['border-top-width' || 'border-style' || <color>] |
| |
| CSS2 value | inherit |
| |
| Initial value | Not defined. |
| |
| Applied to | All elements. |
| |
| Inherited | No. |
| |
Top |
|
| border-color |
|
|
| Shorthand property to set the colour value of one to four borders in one declaration. |
| |
| CSS1 value | <color> (1,4) | transparent |
| |
| CSS2 value | inherit |
| |
| Initial value | The value of the <color> property. |
| |
| Applied to | All elements. |
| |
| Inherited | No. |
| |
| Notes | This property accepts up to four values, which are interpreted as follows:
One value: defines the colour of the four surrounding borders.
Two values: the first defines the colour of the top and bottom borders, and the second that of the left and right borders.
Three values: the first defines the colour of the top border, the second that of the left and right borders, and the third that of the bottom border.
Four values: the colours of the top, right, bottom and left borders respectively. |
| |
Top |
|
| border-bottom-color, border-left-color, border-right-color, border-top-color |
|
|
| Each property sets the colour of the corresponding border. |
| |
| CSS1 value | <color> |
| |
| CSS2 value | inherit |
| |
| Initial value | The value of the <color> property. |
| |
| Applied to | All elements. |
| |
| Inherited | No. |
| |
Top |
|
| border-style |
|
|
| Defines the style of the four borders. |
| |
| CSS1 value | none | dotted | dashed | solid | double | groove | bridge | inset | outset |
| |
| CSS2 value | inherit |
| |
| Initial value | none |
| |
| Applied to | All elements. |
| |
| Inherited | No. |
| |
| Notes | This property can receive between one and four values (see the explanation regarding border-color). If a border's colour is omitted, the browser uses the element's colour. |
| |
Top |
|
| border-bottom-style, border-left-style, border-right-style, border-top-style |
|
|
| Each property defines the style of the corresponding border. |
| |
| CSS1 value | none | dotted | dashed | solid | double | groove | bridge | inset | outset |
| |
| CSS2 value | inherit |
| |
| Initial value | none |
| |
| Applied to | All elements. |
| |
| Inherited | No. |
| |
Top |
|
| border-width |
|
|
| Shorthand property to set the value of the four properties: border-width-top, border-width-right, border-width-bottom, and border-width-left. |
| |
| CSS1 value | [thin | medium | thick] | <length> |
| |
| CSS2 value | inherit |
| |
| Initial value | Not defined. |
| |
| Applied to | All elements. |
| |
| Inherited | No. |
| |
| Notes | This property can be assigned between one and four values (see the explanation for border-color). |
| |
Top |
|
| border-bottom-width, border-left-width, border-right-width, border-top-width |
|
|
| Each property sets the width of the corresponding border. |
| |
| CSS1 value | [thin | medium | thick] | <length> |
| |
| CSS2 value | inherit |
| |
| Initial value | medium |
| |
| Applied to | All elements. |
| |
| Inherited | No. |
| |
Top |
|
| clear |
|
|
| Defines which side of an element's box should not be adjacent to another floating element's box that is already present, i.e. which was rendered earlier. |
| |
| CSS1 value | none | left | right | both |
| |
| CSS2 value | inherit |
| |
| Initial value | none |
| |
| Applied to | Block-level elements. |
| |
| Inherited | No. |
| |
Top |
|
| height, width |
|
|
| To set the height or the width of an element's content area. |
| |
| CSS1 value | <length> | auto |
| |
| CSS2 value | <percentage> | inherit |
| |
| Initial value | auto |
| |
| Applied to | All elements except for non-replaced inline elements, table columns, column groups (for height), and line groups (for width). |
| |
| Inherited | No. |
| |
Top |
|
| margin |
|
|
| Shorthand property to set the values of the four properties: margin-top, margin-right, margin-bottom and margin-left. |
| |
| CSS1 value | <length> | <percentage> | auto |
| |
| CSS2 value | inherit |
| |
| Initial value | Not defined. |
| |
| Applied to | All elements. |
| |
| Inherited | No. |
| |
Top |
|
| margin-bottom, margin-left, margin-right, margin-top |
|
|
| Sets the size of the corresponding margin. |
| |
| CSS1 value | <length> | <percentage> | auto |
| |
| CSS2 value | inherit |
| |
| Initial value | 0 |
| |
| Applied to | All elements. |
| |
| Inherited | No. |
| |
Top |
|
| max-height, max-width |
|
|
| Sets a maximum value for the height or the width of an element's box. |
| |
| CSS1 value | <length> | <percentage> | inherit |
| |
| CSS2 value | 100% |
| |
| Initial value | All elements. |
| |
| Applied to | No. |
| |
| Inherited | A percentage is calculated with respect to the parent block's height or width. |
| |
Top |
|
| min-height, min-width |
|
|
| Sets a minimum value for the height or the width of an element's box. |
| |
| CSS1 value | <length> | <percentage> | inherit |
| |
| CSS2 value | 0 |
| |
| Initial value | All elements. |
| |
| Applied to | No. |
| |
| Inherited | A percentage is calculated in relation to the parent block's height or width. |
| |
Top |
|
| padding |
|
|
| Shorthand property to set the four properties: padding-top, padding-right, padding-bottom and padding-left. |
| |
| CSS1 value | <length> | <percentage> |
| |
| CSS2 value | inherit |
| |
| Initial value | Not defined. |
| |
| Applied to | All elements. |
| |
| Inherited | No. |
| |
Top |
|
| padding-top, padding-right, padding-bottom, padding-left |
|
|
| Each property sets the size of the corresponding padding. |
| |
| CSS1 value | <length> | <percentage> |
| |
| CSS2 value | inherit |
| |
| Initial value | 0 |
| |
| Applied to | All elements. |
| |
| Inherited | No. |
| |
| Notes | Values cannot be negative and percentages refer to the size of the parent block's corresponding padding. |
| |
Top |
|