Style borderLeftプロパティ

Style 对象参考手册Style オブジェクト

定義と使い方

borderLeft プロパティは、左側の枠線に関する3つの独立したプロパティを一括指定形式で設定または取得します。

このプロパティを使用すると、次の項目を設定/取得できます:

  • border-left-width
  • border-left-style
  • border-left-color

構文

borderLeft プロパティを設定する:

Object.style.borderLeft="width style color"

borderLeft プロパティを取得する:

Object.style.borderLeft

ヒント:borderLeft プロパティにデフォルト値はありません。

パラメータ 説明
width 左の枠線の幅を設定します。
style 左の枠線のスタイルを設定します。
color 左の枠線の色を設定します。


ブラウザサポート

Internet ExplorerFirefoxOperaGoogle ChromeSafari

すべての主要ブラウザは borderLeft プロパティをサポートしています。


例

例

左の枠線の幅、スタイル、色を変更します:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>サンプル(example.com)</title>
<style type="text/css">
#ex1{
    border: thin dotted #FF0000;
}
</style>
<script>
function displayResult(){
    document.getElementById("ex1").style.borderLeft="thick solid #0000FF";
}
</script>
</head>
<body>

<div id="ex1">これはテキストです。</div>
<br>
<button type="button" onclick="displayResult()">左の枠線を変更</button>

</body>
</html>

試してみる »


Style 对象参考手册Style オブジェクト その他の拡張