CSSボーダートッププロパティ
例
さまざまな要素の上部境界線のスタイルを設定します。
h1 {
border-top: 5px solid red;
}
h2 {
border-top: 4px dotted blue;
}
div {
border-top: double;
}
定義と使用法
省略形プロパティはborder-top
、1つの宣言ですべての上部境界線プロパティを設定します。
設定できるプロパティは、次の順序である必要があります。
border-top-colorを省略した場合、適用される色はテキストの色になります。
デフォルト値: | ミディアムなしカラー |
---|---|
遺伝性の: | いいえ |
アニメート可能: | はい、個々のプロパティを参照してください。アニメート可能について読む |
バージョン: | CSS1 |
JavaScript構文: | object .style.borderTop = "3px dashed blue" |
ブラウザのサポート
表の数字は、プロパティを完全にサポートする最初のブラウザバージョンを示しています。
Property | |||||
---|---|---|---|---|---|
border-top | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
CSS構文
border-top: border-width border-style border-color|initial|inherit;
プロパティ値
Value | Description |
---|---|
border-top-width | Required. Specifies the width of the top border. Default value is "medium" |
border-top-style | Required. Specifies the style of the top border. Default value is "none" |
border-top-color | Optional. Specifies the color of the top 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
HTML DOMリファレンス:borderTopプロパティ