shape-outside հատկությունը
shape-outside հատկությունը հնարավորություն է տալիս սահմանել ոչ ստանդարտ հոսքի ձևեր լողացող տարրերի համար:
Հարևան տարրերը կհոսեն սահմանված
ձևի շուրջ, այլ ոչ թե ուղղանկյուն կոնտեյների:
Շարահյուսություն
ընտրիչ {
shape-outside: արժեք;
}
Արժեքներ
| Արժեք | Նկարագրություն |
|---|---|
circle() |
Շրջանաձև հոսքի ձև |
ellipse() |
Էլիպսային հոսքի ձև |
polygon() |
Կամայական բազումկյուն ձև |
url() |
Ձև՝ հիմնված պատկերի ալֆա-ալիքի վրա |
margin-box |
Օգտագործել margin-ի սահմանները (լռելյայն արժեք) |
Օրինակ
Ստեղծենք շրջանաձև հոսքի ձև
լողացող տարրի համար:
Օգտագործենք shape-outside և
clip-path հատկությունները:
<div class="shape"></div>
<p>
some long text
</p>
.shape {
width: 150px;
height: 150px;
float: left;
shape-outside: circle(50%);
clip-path: circle(50%);
background: #3498db;
}
p {
width: 500px;
text-align: justify;
}
:
Օրինակ
Սահմանենք բացատ shape-margin հատկության միջոցով:
<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;
}
:
Օրինակ
Առանց clip-path հատկության տեքստը
կհոսի շրջանի շուրջ, բայց տարրը
շրջանի ձև չի ունենա:
<div class="shape"></div>
<p>
some long text
</p>
.shape {
width: 150px;
height: 150px;
float: left;
shape-outside: circle(50%);
background: #3498db;
}
p {
width: 500px;
text-align: justify;
}
:
Օրինակ
Տարրի այլ ձև:
<div class="shape"></div>
<p>
some long text
</p>
.shape {
width: 200px;
height: 200px;
background-color: #4CAF50;
float: left;
shape-outside: polygon(0% 0%, 100% 50%, 0% 100%);
clip-path: polygon(0% 0%, 100% 50%, 0% 100%);
margin-right: 20px;
margin-bottom: 20px;
}
p {
width: 500px;
text-align: justify;
}
:
Օրինակ
Տարրի այլ ձև:
<div class="shape"></div>
<p>
some long text
</p>
.shape {
width: 200px;
height: 200px;
background-color: #4CAF50;
float: left;
shape-outside: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
margin-right: 20px;
margin-bottom: 20px;
}
p {
width: 500px;
text-align: justify;
}
:
Տես նաև
-
clip-pathհատկությունը,
որը ստեղծում է տարրի տեսանելի ձևը -
floatհատկությունը,
անհրաժեշտ shape-outside-ի աշխատանքի համար -
shape-marginհատկությունը,
որը ավելացնում է բացատ ձևի շուրջ