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

ตกแต่งข้อความใน CSS (text-decoration)


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

เพื่อตกแต่งข้อความใน CSS ให้ใช้คุณสมบัติ text-decoration ตัวอย่างต่อไปนี้สาธิตวิธีตกแต่งข้อความ ค่าที่เป็นไปได้: 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: ความหนาของเส้น

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

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