คุณสมบัติชายแดน CSS
ตัวอย่าง
กำหนดรูปแบบของเส้นขอบสำหรับองค์ประกอบต่างๆ:
h1 {
border: 5px solid red;
}
h2 {
border: 4px dotted blue;
}
div {
border:
double;
}
ความหมายและการใช้งาน
border
ทรัพย์สินเป็นทรัพย์สินชวเลขสำหรับ:
- border-width
- แบบเส้นขอบ (จำเป็น)
- เส้นขอบสี
หากละเว้นสีขอบ สีที่ใช้จะเป็นสีของข้อความ
ค่าเริ่มต้น: | ปานกลางไม่มีสี |
---|---|
รับการถ่ายทอด: | ไม่ |
เคลื่อนไหวได้: | ใช่ดูคุณสมบัติแต่ละรายการ อ่านเกี่ยวกับแอนิเมชั่น |
รุ่น: | CSS1 |
ไวยากรณ์ JavaScript: | วัตถุ .style.border="3px สีน้ำเงินทึบ" |
รองรับเบราว์เซอร์
ตัวเลขในตารางระบุเบราว์เซอร์รุ่นแรกที่สนับสนุนคุณสมบัติอย่างสมบูรณ์
Property | |||||
---|---|---|---|---|---|
border | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
ไวยากรณ์ CSS
border: border-width border-style border-color|initial|inherit;
มูลค่าทรัพย์สิน
Value | Description |
---|---|
border-width | Specifies the width of the border. Default value is "medium" |
border-style | Specifies the style of the border. Default value is "none" |
border-color | Specifies the color of the border. Default value is the color of the text |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
หน้าที่เกี่ยวข้อง
กวดวิชา CSS: CSS Border
กวดวิชา CSS: CSS Box Model
การอ้างอิง HTML DOM: คุณสมบัติเส้นขอบ