Theshape-margin
CSS property specifies a margin for a CSS shape created using shape-outside
.
The margin lets you adjust the distance between the edges of the shape (the float element) and the surrounding content.
/* <length> values */ shape-margin: 10px; shape-margin: 20mm; /* <percentage> value */ shape-margin: 60%; /* Global values */ shape-margin: inherit; shape-margin: initial; shape-margin: unset;
<length-percentage>
<length>
value or to a <percentage>
of the width of the element's containing block.<length-percentage>where
<length-percentage> = <length> | <percentage>
<section> <div class="shape"></div> We are not quite sure of any one thing in biology; our knowledge of geology is relatively very slight, and the economic laws of society are uncertain to every one except some individual who attempts to set them forth; but before the world was fashioned the square on the hypotenuse was equal to the sum of the squares on the other two sides of a right triangle, and it will be so after this world is dead; and the inhabitant of Mars, if he exists, probably knows its truth as we know it.</section>
section { max-width: 400px; } .shape { float: left; width: 150px; height: 150px; background-color: maroon; clip-path: polygon(0 0, 150px 150px, 0 150px); shape-outside: polygon(0 0, 150px 150px, 0 150px); shape-margin: 20px; }
Specification | Status | Comment |
---|---|---|
CSS Shapes Module Level 1 The definition of 'shape-margin' in that specification. | Candidate Recommendation | Initial definition |
Initial value | 0 |
---|---|
Applies to | floats |
Inherited | no |
Percentages | refer to the width of the containing block |
Media | visual |
Computed value | as specified, but with relative lengths converted into absolute lengths |
Animation type | a length, percentage or calc(); |
Canonical order | the unique non-ambiguous order defined by the formal grammar |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 37 | ? | 62
|
No | 24 | 10.1
|
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | 37 | 37 | ? | 62
|
24 | 10.3 | 4.0 |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/shape-margin