border-top-style
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
試してみましょう
border-top-style: none;
border-top-style: dotted;
border-top-style: dashed;
border-top-style: solid;
border-top-style: groove;
border-top-style: inset;
This is a box with a border around it.
#example-element {
background-color: #eee;
color: #000;
border: 0.75em solid;
padding: 0.75em;
width: 80%;
height: 100px;
}
body {
background-color: #fff;
}
メモ: 仕様書では、異なるスタイルの境界線を角でどのように接続するかを定義していません。
構文
css
/* キーワード値 */
border-top-style: none;
border-top-style: hidden;
border-top-style: dotted;
border-top-style: dashed;
border-top-style: solid;
border-top-style: double;
border-top-style: groove;
border-top-style: ridge;
border-top-style: inset;
border-top-style: outset;
/* グローバル値 */
border-top-style: inherit;
border-top-style: initial;
border-top-style: revert;
border-top-style: revert-layer;
border-top-style: unset;
公式定義
初期値 | none |
---|---|
適用対象 | すべての要素。 ::first-letter にも適用されます。 |
継承 | なし |
計算値 | 指定通り |
アニメーションの種類 | 離散値 |
形式文法
例
border-top-style の設定
HTML
html
none
hidden
dotted
dashed
solid
double
groove
ridge
inset
outset
CSS
css
/* 表の外見を定義 */
table {
border-width: 2px;
background-color: #52e385;
}
tr,
td {
padding: 3px;
}
/* border-top-style の例のクラス */
.b1 {
border-top-style: none;
}
.b2 {
border-top-style: hidden;
}
.b3 {
border-top-style: dotted;
}
.b4 {
border-top-style: dashed;
}
.b5 {
border-top-style: solid;
}
.b6 {
border-top-style: double;
}
.b7 {
border-top-style: groove;
}
.b8 {
border-top-style: ridge;
}
.b9 {
border-top-style: inset;
}
.b10 {
border-top-style: outset;
}
結果
仕様書
Specification |
---|
CSS Backgrounds and Borders Module Level 3 # the-border-style |
ブラウザーの互換性
関連情報
- その他のスタイルに関する境界のプロパティ:
border-left-style
,border-right-style
,border-bottom-style
,border-style
- その他の左側の境界に関するプロパティ:
border-top
,border-top-color
,border-top-width