语法:
outline:[outline-color] || [outline-style] || [outline-width] || [outline-offset] | inherit
相关属性:outline-style , outline-width , outline-offset , outline-color
取值:
- <outline-color>:
- 指定轮廓边框颜色。参见outline-color
- <outline-style>:
- 指定轮廓边框轮廓。参见outline-style
- <outline-width>:
- 指定轮廓边框宽度。参见outline-width
- <outline-offset>:
- 指定轮廓边框偏移位置的数值。参见outline-offset
- inherit:
- 默认。
说明:
- outline (轮廓)是给元素周围绘制轮廓外边框,通过设置一个数值使边框边缘的外围偏移,可起到突出元素的作用。
- outline 属性可设置元素周围的轮廓线。
- 轮廓线不会占据空间,也不一定是矩形。
- outline 属性是一个简写属性,用于设置元素周围的轮廓线。
兼容性:
类型 | ![]() |
![]() |
![]() |
![]() |
![]() |
---|---|---|---|---|---|
版本 | (×)IE6 | (√)Firefox 3.0.10 | (√)Chrome 2.0.x | (√)Opera 9.64 | (√)Safari 4 |
(×)IE7 | (√)Firefox 3.5 | ||||
(√)IE8 | |||||
示例:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="utf-8" /> <meta name="robots" content="all" /> <meta name="author" content="Tencent-ISRD" /> <meta name="Copyright" content="Tencent" /> <title>outline</title> </head> <body> <div style="width: 160px;padding: 10px;height: 30px;border: 2px solid black;outline-color:#897048;outline-style:groove;outline-width:2px;outline-offset: 5px;">这绘制的是一个轮廓边框</div> </body> </html>