CSS outline 属性


实例

设置元素周围的轮廓:

p
{
outline:#00FF00 dotted thick;
}

尝试一下 »

属性定义及使用说明

outline(轮廓)是绘制于元素周围的一条线,位于边框边缘的外围,可起到突出元素的作用。

outline简写属性在一个声明中设置所有的轮廓属性。

可以设置的属性分别是(按顺序):outline-color, outline-style, outline-width

如果不设置其中的某个值,也不会出问题,比如 outline:solid #ff0000; 也是允许的。

默认值: invert none medium
继承: no
版本: CSS2
JavaScript 语法: object.style.outline="#0000FF dotted thin"


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主流浏览器都支持outline属性。

注意:IE8只有指定!DOCTYPE才支持outline属性。


提示和注释

The outline is not a part of the element's dimensions, therefore the element's width and height properties do not contain the width of the outline.


属性值

描述
outline-color 规定边框的颜色。参阅:outline-color 中可能的值。
outline-style 规定边框的样式。参阅:outline-style 中可能的值。
outline-width 规定边框的宽度。参阅:outline-width 中可能的值。
inherit 规定应该从父元素继承 outline 属性的设置。


相关文章

CSS 教程: CSS Outline