CSS ระบุ border-top-color
- หน้าก่อน border-top
- หน้าต่อไป border-top-left-radius
Definition and Usage
border-top-color sets the color of the top border of the element.
Only pure colors can be defined, and the border may only appear when the border style is a value other than none or hidden.
หมายเหตุ:Always declare the border-style property before the border-color property. The element must have a border before you change its color.
See also:
CSS Tutorial:เขตเบราเยิ้ดของ CSS
CSS Reference Manual:border-top Property
HTML DOM Reference Manual:borderTopColor Property
Example
Set the border-top color:
p { border-style:solid; border-top-color:#ff0000; }
CSS Syntax
border-top-color: color|transparent|initial|inherit;
Property Value
Property Value
Value | Description |
---|---|
color_name | Specifies the border color as a color name (e.g., red). |
hex_number | Specifies the border color as a hexadecimal value (e.g., #ff0000). |
rgb_number | Specifies the border color as an rgb code (e.g., rgb(255,0,0)). |
transparent | Default Value. The border color is transparent. |
inherit | Specifies that the border color should be inherited from the parent element. |
Technical Details
Default Value: | not specified |
---|---|
Inheritance: | no |
Version: | CSS1 |
JavaScript Syntax: | object.style.borderTopColor="blue" |
ตัวอย่างเพิ่มเติม
- ตั้งสีของเข็มขัดบนสุด
- ตัวอย่างนี้แสดงวิธีการตั้งสีของเข็มขัดบนสุด
การสนับสนุนเบราเซอร์
ตัวเลขในตารางระบุเวอร์ชั่นเบราเซอร์แรกที่สนับสนุนคุณสมบัตินี้อย่างเต็มที่。
Chrome | IE / Edge | Firefox | Safari | Opera |
---|---|---|---|---|
1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
หมายเหตุ:Internet Explorer 6 (และเวอร์ชั่นที่เก่ากว่า) ไม่สนับสนุนค่าตัวแปร "transparent"。
หมายเหตุ:IE7 และเวอร์ชั่นเบราเซอร์ที่เก่ากว่าไม่สนับสนุนค่า "inherit"。IE8 ต้องการ !DOCTYPE。IE9 สนับสนุน "inherit"。
- หน้าก่อน border-top
- หน้าต่อไป border-top-left-radius