CARVIEW |
Select Language
HTTP/2 200
content-type: text/html
x-guploader-uploadid: AAwnv3KdAu9J5EkzAwOCkfZ98Ue8cX4W0oDOba7l5I1kIV96eIn0KMd24_dvNAFaegKFJ3s_
cache-control: public, max-age=3600
expires: Fri, 10 Oct 2025 12:13:11 GMT
last-modified: Fri, 10 Oct 2025 01:11:55 GMT
etag: W/"5d60c38b54bee703426ca1e437dfdc79"
x-goog-generation: 1760058715421252
x-goog-metageneration: 1
x-goog-stored-content-encoding: identity
x-goog-stored-content-length: 275639
x-goog-meta-goog-reserved-file-mtime: 1760056735
x-goog-hash: crc32c=VJCecg==, md5=XWDDi1S+5wNCbKHkN9/ceQ==
x-goog-storage-class: STANDARD
accept-ranges: none
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
alt-svc: clear
referrer-policy: strict-origin-when-cross-origin
x-content-type-options: nosniff
strict-transport-security: max-age=63072000
content-security-policy: default-src 'self'; script-src 'report-sample' 'self' 'wasm-unsafe-eval' https://www.google-analytics.com/analytics.js https://www.googletagmanager.com/gtag/js assets.codepen.io production-assets.codepen.io https://js.stripe.com 'sha256-XNBp89FG76amD8BqrJzyflxOF9PaWPqPqvJfKZPCv7M=' 'sha256-YCNoU9DNiinACbd8n6UPyB/8vj0kXvhkOni9/06SuYw=' 'sha256-PZjP7OR6mBEtnvXIZfCZ5PuOlxoDF1LDZL8aj8c42rw='; script-src-elem 'report-sample' 'self' 'wasm-unsafe-eval' https://www.google-analytics.com/analytics.js https://www.googletagmanager.com/gtag/js assets.codepen.io production-assets.codepen.io https://js.stripe.com 'sha256-XNBp89FG76amD8BqrJzyflxOF9PaWPqPqvJfKZPCv7M=' 'sha256-YCNoU9DNiinACbd8n6UPyB/8vj0kXvhkOni9/06SuYw=' 'sha256-PZjP7OR6mBEtnvXIZfCZ5PuOlxoDF1LDZL8aj8c42rw='; style-src 'report-sample' 'self' 'unsafe-inline'; object-src 'none'; base-uri 'self'; connect-src 'self' developer.allizom.org bcd.developer.allizom.org bcd.developer.mozilla.org updates.developer.allizom.org updates.developer.mozilla.org https://*.google-analytics.com https://*.analytics.google.com https://*.googletagmanager.com https://incoming.telemetry.mozilla.org https://observatory-api.mdn.allizom.net https://observatory-api.mdn.mozilla.net https://api.github.com/search/issues stats.g.doubleclick.net https://api.stripe.com; font-src 'self'; frame-src 'self' interactive-examples.mdn.mozilla.net interactive-examples.mdn.allizom.net mdn.github.io live-samples.mdn.mozilla.net live-samples.mdn.allizom.net *.mdnplay.dev *.mdnyalp.dev *.play.test.mdn.allizom.net https://v2.scrimba.com https://scrimba.com jsfiddle.net www.youtube-nocookie.com codepen.io survey.alchemer.com https://js.stripe.com; img-src 'self' data: *.githubusercontent.com *.googleusercontent.com *.gravatar.com mozillausercontent.com firefoxusercontent.com profile.stage.mozaws.net profile.accounts.firefox.com developer.mozilla.org mdn.dev interactive-examples.mdn.mozilla.net interactive-examples.mdn.allizom.net wikipedia.org upload.wikimedia.org https://mdn.github.io/shared-assets/ https://mdn.dev/ https://*.google-analytics.com https://*.googletagmanager.com www.gstatic.com; manifest-src 'self'; media-src 'self' archive.org videos.cdn.mozilla.net https://mdn.github.io/shared-assets/; child-src 'self'; worker-src 'self';
x-frame-options: DENY
origin-trial: AxVILwizhbMjxFeHOn1P3R8niO1RJY/smaK4B4d1rLzc1gTaxtXMSaTi+FoigYgCw40uFRDwFcEAeqDR+vVLOW4AAABfeyJvcmlnaW4iOiJodHRwczovL2RldmVsb3Blci5tb3ppbGxhLm9yZyIsImZlYXR1cmUiOiJQcml2YXRlQXR0cmlidXRpb25WMiIsImV4cGlyeSI6MTc0MjA3OTYwMH0=
x-cloud-trace-context: 6ebe87f73e6016db4a994b16e74546b3
date: Fri, 10 Oct 2025 11:13:11 GMT
server: Google Frontend
via: 1.1 google
vary: Accept-Encoding
content-encoding: gzip
x-cache: miss
shape-margin - CSS: カスケーディングスタイルシート | MDN
Toggle sidebar
>
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
shape-margin
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2020年1月.
shape-margin
は CSS のプロパティで、shape-outside
を使用して作成された CSS シェイプのマージンを設定します。
試してみましょう
shape-margin: 0;
shape-margin: 20px;
shape-margin: 1em;
shape-margin: 5%;
<section class="default-example" id="default-example">
<div class="example-container">
<div class="transition-all" id="example-element"></div>
We had agreed, my companion and I, that I should call for him at his house,
after dinner, not later than eleven o’clock. This athletic young Frenchman
belongs to a small set of Parisian sportsmen, who have taken up “ballooning”
as a pastime. After having exhausted all the sensations that are to be found
in ordinary sports, even those of “automobiling” at a breakneck speed, the
members of the “Aéro Club” now seek in the air, where they indulge in all
kinds of daring feats, the nerve-racking excitement that they have ceased to
find on earth.
</div>
</section>
.example-container {
text-align: left;
padding: 20px;
}
#example-element {
float: left;
margin: 20px;
width: 180px;
height: 180px;
border-radius: 50%;
background-color: rebeccapurple;
shape-outside: circle(50%);
}
マージンで、シェイプ (浮動要素) の縁と周囲のコンテンツとの間隔を調整することができます。
構文
css
/* <length> 値 */
shape-margin: 10px;
shape-margin: 20mm;
/* <percentage> 値 */
shape-margin: 60%;
/* グローバル値 */
shape-margin: inherit;
shape-margin: initial;
shape-margin: revert;
shape-margin: unset;
値
<length-percentage>
-
シェイプのマージンを
<length>
値または要素の包含ブロックの幅に対する<percentage>
で設定します。
公式定義
形式文法
shape-margin =
<length-percentage [0,∞]>
<length-percentage> =
<length> |
<percentage>
例
>多角形にマージンを追加
HTML
html
<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 one exists, probably
knows its truth as we know it.
</section>
CSS
css
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 |
---|
CSS Shapes Module Level 1> # shape-margin-property> |
ブラウザーの互換性
Loading…