スタイルborderTopプロパティ
例
<div>要素に上枠を追加します。
document.getElementById("myDiv").style.borderTop = "thick solid #0000FF";
定義と使用法
borderTopプロパティは、最大3つの個別のborder-topプロパティを省略形で設定または返します。
このプロパティを使用すると、次の1つ以上を(任意の順序で)設定/返すことができます。
- border-top-width
- ボーダートップスタイル
- ボーダートップカラー
ブラウザのサポート
Property | |||||
---|---|---|---|---|---|
borderTop | Yes | Yes | Yes | Yes | Yes |
構文
borderTopプロパティを返します。
object.style.borderTop
borderTopプロパティを設定します。
object.style.borderTop = "width style color|initial|inherit"
プロパティ値
Parameter | Description |
---|---|
width | Sets the width of the top border |
style | Sets the style of the top border |
color | Sets the color of the top border |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
技術的な詳細
デフォルト値: | 指定されていない |
---|---|
戻り値: | 要素の上部境界線の幅、スタイル、色を表す文字列 |
CSSバージョン | CSS1 |
その他の例
例
<div>要素の上部の境界線の幅、スタイル、色を変更します。
document.getElementById("myDiv").style.borderTop = "thin dotted red";
例
<div>要素のborder-topプロパティ値を返します。
alert(document.getElementById("myDiv").style.borderTop);
関連ページ
CSSチュートリアル:CSS Border
CSSリファレンス:border-topプロパティ
HTML DOMリファレンス:borderプロパティ
❮スタイルオブジェクト