คุณสมบัติการตกแต่งข้อความ CSS
ตัวอย่าง
ตั้งค่าการตกแต่งข้อความที่แตกต่างกันสำหรับองค์ประกอบ <h1>, <h2> และ <h3>:
h1 {
text-decoration: overline;
}
h2 {
text-decoration: line-through;
}
h3 {
text-decoration: underline;
}
h4 {
text-decoration: underline
overline;
}
ตัวอย่าง "ลองใช้เอง" เพิ่มเติมด้านล่าง
ความหมายและการใช้งาน
คุณสมบัติระบุ การtext-decoration
ตกแต่งที่เพิ่มลงในข้อความ และเป็นคุณสมบัติชวเลขสำหรับ:
- text-decoration-line (จำเป็น)
- ข้อความตกแต่งสี
- ข้อความตกแต่งสไตล์
ค่าเริ่มต้น: | ไม่มีกระแสสีที่เป็นของแข็ง |
---|---|
รับการถ่ายทอด: | ไม่ |
เคลื่อนไหวได้: | ไม่ดูคุณสมบัติส่วนบุคคล อ่านเกี่ยวกับแอนิเมชั่น |
รุ่น: | CSS1 ต่ออายุใน CSS3 |
ไวยากรณ์ JavaScript: | วัตถุ .style.textDecoration="ขีดเส้นใต้" |
รองรับเบราว์เซอร์
ตัวเลขในตารางระบุเบราว์เซอร์รุ่นแรกที่สนับสนุนคุณสมบัติอย่างสมบูรณ์
Property | |||||
---|---|---|---|---|---|
text-decoration | 1.0 | 3.0 | 1.0 | 1.0 | 3.5 |
ไวยากรณ์ CSS
text-decoration: text-decoration-line text-decoration-color
text-decoration-style|initial|inherit;
มูลค่าทรัพย์สิน
Value | Description |
---|---|
text-decoration-line | Sets the kind of text decoration to use (like underline, overline, line-through) |
text-decoration-color | Sets the color of the text decoration |
text-decoration-style | Sets the style of the text decoration (like solid, wavy, dotted, dashed, double) |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
ตัวอย่างเพิ่มเติม
ตัวอย่าง
เพิ่มการตกแต่งข้อความ:
h1 {
text-decoration: underline overline dotted red;
}
h2 {
text-decoration: underline overline wavy
blue;
}
หน้าที่เกี่ยวข้อง
กวดวิชา CSS: CSS Text
การอ้างอิง HTML DOM: คุณสมบัติ textDecoration