CSSボーダープロパティ
例
さまざまな要素の境界線のスタイルを設定します。
h1 {
border: 5px solid red;
}
h2 {
border: 4px dotted blue;
}
div {
border:
double;
}
定義と使用法
プロパティは、次のborder
略記プロパティです。
border-colorを省略した場合、適用される色はテキストの色になります。
デフォルト値: | ミディアムなしカラー |
---|---|
遺伝性の: | いいえ |
アニメート可能: | はい、個々のプロパティを参照してください。アニメート可能について読む |
バージョン: | CSS1 |
JavaScript構文: | object .style.border = "3px solid blue" |
ブラウザのサポート
表の数字は、プロパティを完全にサポートする最初のブラウザバージョンを示しています。
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ボックスモデル
HTML DOMリファレンス:borderプロパティ