Movatterモバイル変換


[0]ホーム

URL:


  1. 面向开发者的 Web 技术
  2. CSS:层叠样式表
  3. CSS 参考
  4. 属性
  5. outline-style

此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in EnglishAlways switch to English

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 2015年7月.

outline-style CSS 属性被用于设置一个元素轮廓的样式。

元素轮廓是绘制于元素周围的一条线,位于border的外围,使元素突出

大多时候使用outline而不是outline-style,outline-widthoutline-color 会更方便。

初始值none
适用元素所有元素
是否是继承属性
计算值as specified
动画类型按计算值的类型

语法

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;

取值

<br-style> 可为以下这些值:

none

无轮廓 (outline-width0).

dotted

轮廓为一系列点。

dashed

轮廓为一系列短线。

solid

轮廓为实线。

double

轮廓为两根有空隙的线。outline-width 为线与空间的总和。

groove

轮廓呈凹下状。

ridge

groove 相反:轮廓呈凸起状。

inset

轮廓呈嵌入状。

outset

inset 相反:轮廓呈突出状。

正式语法

outline-style =
auto|
<outline-line-style>

<outline-line-style> =
none|
auto|
dotted|
dashed|
solid|
double|
groove|
ridge|
inset|
outset

示例

dotteddashed

HTML

html
<div>  <div>    <p>Outline Demo</p>  </div></div>

CSS

css
.dotted {  outline-style: dotted; /* 于 "outline: dotted"等价 */}.dashed {  outline-style: dashed;}/* 让效果更清楚 */* {  outline-width: 10px;  padding: 15px;}

soliddouble

HTML

html
<div>  <div>    <p>Outline Demo</p>  </div></div>

CSS

css
.solid {  outline-style: solid;}.double {  outline-style: double;}/* 让效果更清楚 */* {  outline-width: 10px;  padding: 15px;}

grooveridge

HTML

html
<div>  <div>    <p>Outline Demo</p>  </div></div>

CSS

css
.groove {  outline-style: groove;}.ridge {  outline-style: ridge;}/* 让效果更清楚 */* {  outline-width: 10px;  padding: 15px;}

insetoutset

HTML

html
<div>  <div>    <p>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

浏览器兼容性

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp