--- title: margin slug: Web/CSS/Margin translation_of: Web/CSS/margin translation_of_original: Web/CSS/margin-new ---
{{ CSSRef() }}
Własność margin określa marginesy elementu. Jest ona również sposobem na ustawienie wszystkich marginesów jednocześnie. Negatywne wartosci są dozwolone.
{{cssinfo}}
margin: <length> {1,4} | <percentage> {1,4} | inherit | auto;
Jeśli podano:
.content {
margin: 5%; /* wszystkie strony margines 5% */
}
.sidebox {
margin: 10px; /* wszystkie strony margines 10px */
}
.rightbox {
margin: 10px 20px; /* górny i dolny margines 10px */
} /* lewy i prawy margines 20px */
.leftbox { /* górny margines 10px */
margin: 10px 3% 20px; /* lewy i prawy margines 3% */
} /* dolny margines 20px */
.mainbox { /* górny margines 10px */
margin: 10px 3px 30px 5px; /* prawy margines 3px */
} /* dolny margines 30px */
/* lewy margines 5px */
| Specification | Status | Comment |
|---|---|---|
| {{ SpecName('CSS3 Box', '#margin', 'margin') }} | {{ Spec2('CSS3 Box') }} | No significant change |
| {{ SpecName('CSS3 Transitions', '#animatable-css', 'margin') }} | {{ Spec2('CSS3 Transitions') }} | Defines margin as animatable. |
| {{ SpecName('CSS2.1', 'box.html#margin-properties', 'margin') }} | {{ Spec2('CSS2.1') }} | Removes its effect on inline elements. |
| {{ SpecName('CSS1', '#margin', 'margin') }} | {{ Spec2('CSS1') }} | Initial definition |
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
{{Compat("css.properties.margin")}}