text-stroke касиети
text-stroke касиети текст символдорунун контурдун түсүн жана калыңдыгын же анын контурун коёт.
Касиетке маани катары контурдун калыңдыгын жана боштук менен контурдун түсүн бериш керек.
Синтаксис
селектор {
text-stroke: контурдун калыңдыгы жана анын түсү;
}
Негизги мисал
Жөнөкөй текст контуру:
<div class="stroked-text">
Lorem ipsum dolor sit amet
</div>
.stroked-text {
font-size: 48px;
font-weight: bold;
-webkit-text-stroke: 2px red;
text-stroke: 2px red;
}
:
Контур гана
Эми тексттин түсүн фондун түсү менен дал келтирип көрөлү (биздин учурда ак). Натыйжада контур гана калат:
<div class="stroked-text">
Lorem ipsum dolor sit amet
</div>
.stroked-text {
font-size: 48px;
font-weight: bold;
color: white;
-webkit-text-stroke: 2px black;
text-stroke: 2px black;
}
:
Градиенттүү контур
background-clip касиетинин жардамы менен
градиенттүү контур жасайлы:
<div class="gradient-stroke">
Lorem ipsum dolor sit amet
</div>
.gradient-stroke {
font-size: 42px;
font-weight: bold;
background: linear-gradient(to right, #ff8a00, #e52e71);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
-webkit-text-stroke: 1px #333;
text-stroke: 1px #333;
}
:
Көп контур
text-shadow касиетинин жардамы менен кош контур эффектиси:
<div class="double-stroke">
Lorem ipsum dolor sit amet
</div>
.double-stroke {
font-size: 40px;
color: white;
-webkit-text-stroke: 3px #000;
text-stroke: 3px #000;
text-shadow:
0 0 5px #000,
0 0 10px #000;
}
:
Анимацияланган контур
Контурдун өзгөрүү анимациясын кошолу:
<div class="animated-stroke">
Lorem ipsum dolor sit amet
</div>
.animated-stroke {
font-size: 38px;
color: white;
-webkit-text-stroke: 1px #ff0000;
text-stroke: 1px #ff0000;
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { -webkit-text-stroke: 1px #ff0000; text-stroke: 1px #ff0000; }
50% { -webkit-text-stroke: 3px #ff0000; text-stroke: 3px #ff0000; }
100% { -webkit-text-stroke: 1px #ff0000; text-stroke: 1px #ff0000; }
}
:
Дагы караңыз
-
text-fill-colorкасиети,
текст символдорунун толтуруу түсүн коёт -
text-stroke-colorкасиети,
тексттин контур түсүн коёт -
text-stroke-widthкасиети,
тексттин контур калыңдыгын коёт