თვისება 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,
რომელიც ადგენს ტექსტის კონტურის სისქეს