企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# CSS outline-width 属性 ## 实例 设置点状轮廓的颜色: ``` p { outline-style:dotted; outline-width:5px; } ``` ## 浏览器支持 所有浏览器都支持 outline-width 属性。 注释:如果规定了 !DOCTYPE,则 IE8 支持 outline 属性。 ## 定义和用法 outline-width 属性设置元素整个轮廓的宽度,只有当轮廓样式不是 none 时,这个宽度才会起作用。如果样式为 none,宽度实际上会重置为 0。不允许设置负长度值。 outline(轮廓)是绘制于元素周围的一条线,位于边框边缘的外围,可起到突出元素的作用。outline 属性设置元素周围的轮廓线。 注释:请始终在 outline-width 属性之前声明 outline-style 属性。元素只有获得轮廓以后才能改变其轮廓的颜色。 注释:轮廓线不会占据空间,也不一定是矩形。 | 默认值: | medium | | --- | --- | | 继承性: | no | | --- | --- | | 版本: | CSS2 | | --- | --- | | JavaScript 语法: | _object_.style.outlineWidth="thin" | | --- | --- | ## 可能的值 | 值 | 描述 | | --- | --- | | thin | 规定细轮廓。 | | medium | 默认。规定中等的轮廓。 | | thick | 规定粗的轮廓。 | | _length_ | 允许您规定轮廓粗细的值。 | | inherit | 规定应该从父元素继承轮廓宽度的设置。 | ## TIY 实例 [设置轮廓的宽度](/tiy/t.asp?f=csse_outline-width) 本例演示如何设置轮廓的宽度。 ``` <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <style type="text/css"> p.one { border:red solid thin; outline-style:solid; outline-width:thin; } p.two { border:red solid thin; outline-style:dotted; outline-width:3px; } </style> </head> <body> <p class="one">This is some text in a paragraph.</p> <p class="two">This is some text in a paragraph.</p> <p><b>注释:</b>只有在规定了 !DOCTYPE 时,Internet Explorer 8 (以及更高版本) 才支持 outline-width 属性。</p> </body> </html> ``` ## 相关页面 CSS 教程:[CSS 轮廓](/css/css_outline.asp "CSS 轮廓") CSS 参考手册:[outline 属性](/cssref/pr_outline.asp "CSS outline 属性") HTML DOM 参考手册:[outlineWidth 属性](/jsref/prop_style_outlinewidth.asp "HTML DOM outlineWidth 属性")