Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> JavaScript

การใช้งานคุณสมบัติ text-decoration ใน CSS


คุณสมบัติ text-decoration

คุณสมบัติ text-decoration ใช้สำหรับขีดเส้นใต้ (underline), เส้นบน (overline), และขีดทับ (line-through/strikethrough) ข้อความ

ตัวอย่าง

ตัวอย่างต่อไปนี้สาธิตวิธีตกแต่งข้อความ ค่าที่เป็นไปได้: none, underline, overline, line-through, blink

<html>
  <head>
  </head>
  <body>
    <p style="text-decoration:underline;">
      This will be underlined </p>
    <p style="text-decoration:line-through;">
      This will be striked through. </p>
    <p style="text-decoration:overline;">
      This will have a over line. </p>
    <p style="text-decoration:blink;">
      This text will have blinking effect </p>
  </body>
</html>

ค่าที่ใช้ได้ (CSS3):

  • line: underline, overline, line-through
  • style: solid, double, dotted, dashed, wavy
  • color: สีของเส้น
  • thickness: ความหนาของเส้น (auto, from-font, <length>)

รูปแบบใหม่: text-decoration: underline wavy red 2px;

หมายเหตุ: blink ล้าสมัยแล้ว และเบราว์เซอร์ส่วนใหญ่ไม่รองรับ