คุณสมบัติ shape-margin
คุณสมบัติ shape-margin กำหนดการเยื้องรอบรูปทรง
ที่กำหนดโดยคุณสมบัติ shape-outside
สิ่งนี้ช่วยเพิ่มระยะห่างระหว่างรูปทรงกับข้อความที่ไหลรอบๆ
ไวยากรณ์
selector {
shape-margin: value;
}
ตัวอย่าง
วงกลมที่มีการเยื้อง 20px:
<div class="shape"></div>
<p>
some long text
</p>
.shape {
width: 150px;
height: 150px;
float: left;
shape-outside: circle(50%);
shape-margin: 10px;
clip-path: circle(50%);
background: #3498db;
}
p {
width: 500px;
text-align: justify;
}
:
ตัวอย่าง
รูปสามเหลี่ยมที่มีการเยื้อง 1em:
<div class="shape"></div>
<p>
some long text
</p>
.shape {
width: 150px;
height: 150px;
float: left;
shape-outside: polygon(0% 0%, 100% 50%, 0% 100%);
shape-margin: 1em;
clip-path: polygon(0% 0%, 100% 50%, 0% 100%);
background: #e74c3c;
}
p {
width: 500px;
text-align: justify;
}
:
ดูเพิ่มเติม
-
คุณสมบัติ
shape-outside,
ซึ่งกำหนดรูปทรงสำหรับการไหล -
คุณสมบัติ
clip-path,
ซึ่งสร้างรูปทรงที่มองเห็นได้ขององค์ประกอบ -
คุณสมบัติ
float,
ที่จำเป็นสำหรับการทำงานของ shape-margin