outline-style
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2017.
概要
语法
css
/* 关键字 值 */
outline-style: auto;
outline-style: none;
outline-style: dotted;
outline-style: dashed;
outline-style: solid;
outline-style: double;
outline-style: groove;
outline-style: ridge;
outline-style: inset;
outline-style: outset;
/* 全局 值*/
outline-style: inherit;
outline-style: initial;
outline-style: unset;
取值
正式语法
outline-style =
auto |
<outline-line-style>
示例
dotted
和 dashed
HTML
html
<div>
<div class="dotted">
<p class="dashed">Outline Demo</p>
</div>
</div>
CSS
css
.dotted {
outline-style: dotted; /* 于 "outline: dotted"等价 */
}
.dashed {
outline-style: dashed;
}
/* 让效果更清楚 */
* {
outline-width: 10px;
padding: 15px;
}
solid
和 double
HTML
html
<div>
<div class="solid">
<p class="double">Outline Demo</p>
</div>
</div>
CSS
css
.solid {
outline-style: solid;
}
.double {
outline-style: double;
}
/* 让效果更清楚 */
* {
outline-width: 10px;
padding: 15px;
}
groove
和 ridge
HTML
html
<div>
<div class="groove">
<p class="ridge">Outline Demo</p>
</div>
</div>
CSS
css
.groove {
outline-style: groove;
}
.ridge {
outline-style: ridge;
}
/* 让效果更清楚 */
* {
outline-width: 10px;
padding: 15px;
}
inset
和 outset
HTML
html
<div>
<div class="inset">
<p class="outset">Outline Demo</p>
</div>
</div>
CSS
css
.inset {
outline-style: inset;
}
.outset {
outline-style: outset;
}
/* 让效果更清楚 */
* {
outline-width: 10px;
padding: 15px;
}
规范
Specification |
---|
CSS Basic User Interface Module Level 4 # outline-style |
浏览器兼容性
BCD tables only load in the browser