Computer >> คอมพิวเตอร์ >  >> การเขียนโปรแกรม >> CSS

กำหนดสไตล์การตกแต่งข้อความใน CSS


ในการตั้งค่าสไตล์การตกแต่งข้อความ ให้ใช้คุณสมบัติ text-decoration-style คุณสามารถใช้ค่าต่อไปนี้ -

text-decoration-style: solid|double|dotted|dashed|wavy|initial|inherit;

ตัวอย่าง

<!DOCTYPE html>
<html>
<head>
<style>
span {
   text-decoration: line-through;
   text-decoration-color: blue;
}
.demo2 {
   text-decoration: underline;
   text-decoration-style: double;
   text-decoration-color: red;
}
</style>
</head>
<body>
<h1>Details</h1>
<p class="demo">Examination Center near <span>XYZ College</span> ABC College.</p>
<p class="demo2">Exam begins at 11AM.</p>
</body>
</html>

ผลลัพธ์

กำหนดสไตล์การตกแต่งข้อความใน CSS

ตัวอย่าง

เรามาดูตัวอย่างอื่นกัน −

<!DOCTYPE html>
<html>
<head>
<style>
.demo {
   text-decoration: overline;
   text-decoration-color: blue;
   text-decoration-style: wavy;
}
.demo2 {
   text-decoration: overline;
   text-decoration-style: dashed;
   text-decoration-color: red;
}
</style>
</head>
<body>
<h1>Details</h1>
<p class="demo">Examination Center near ABC College.</p>
<p class="demo2">Exam begins at 11AM.</p>
</body>
</html>

ผลลัพธ์

กำหนดสไตล์การตกแต่งข้อความใน CSS