outline-width
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-width
用于设置一个元素的轮廓的厚度。元素轮廓是绘制于元素周围的一条线,位于 border
的外围。
尝试一下
大多情况下用简写属性 outline
定义轮廓外观会更方便。
Syntax
css
/* Keyword values */
outline-width: thin;
outline-width: medium;
outline-width: thick;
/* <length> values */
outline-width: 1px;
outline-width: 0.1em;
/* Global values */
outline-width: inherit;
outline-width
的值可以是下面列表中的任一项。
Values
Formal syntax
outline-width =
<line-width>
<line-width> =
<length [0,∞]> |
thin |
medium |
thick
Examples
HTML
html
<span id="thin">thin</span>
<span id="medium">medium</span>
<span id="thick">thick</span>
<span id="twopixels">2px</span>
<span id="oneex">1ex</span>
<span id="em">1.2em</span>
CSS
css
span {
outline-style: solid;
display: inline-block;
margin: 20px;
}
#thin {
outline-width: thin;
}
#medium {
outline-width: medium;
}
#thick {
outline-width: thick;
}
#twopixels {
outline-width: 2px;
}
#oneex {
outline-width: 1ex;
}
#em {
outline-width: 1.2em;
}
Specifications
Specification |
---|
CSS Basic User Interface Module Level 4 # outline-width |
Browser compatibility
BCD tables only load in the browser