属性定义及使用说明
outline(轮廓)是绘制于元素周围的一条线,位于边框边缘的外围。
outline-width指定轮廓的宽度。
注意: 请始终在outline-width属性之前声明outline-style属性。元素只有获得轮廓以后才能改变其轮廓的宽度。
| 默认值: | medium |
|---|---|
| 继承: | no |
| 版本: | CSS2 |
| JavaScript 语法: | object.style.outlineWidth=”thin” |
提示和注释
outline是围绕元素。它是围绕元素的边距。但是,它是来自不同的边框属性。
outline不是元素尺寸的一部分,因此元素的宽度和高度属性不包含轮廓的宽度。
属性值
| 值 | 描述 |
|---|---|
| thin | 规定细轮廓。 |
| medium | 默认。规定中等的轮廓。 |
| thick | 规定粗的轮廓。 |
| length | 允许您规定轮廓粗细的值。 |
| inherit | 规定应该从父元素继承轮廓宽度的设置。 |
浏览器支持
表格中的数字表示支持该属性的第一个浏览器版本号。
| 属性 | 谷歌 | IE | 火狐 | 苹果 | opera |
|---|---|---|---|---|---|
| outline | 1.0 | 6.0 | 1.0 | 1.0 | 3.5 |
实例
设置轮廓的宽度:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Web176教程(web176.com)</title>
<style>
p.one
{
border:1px solid red;
outline-style:solid;
outline-width:thin;
}
p.two
{
border:1px solid red;
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 指定 IE8 支持 outline 属性。</p>
</body>
</html>作者:terry,如若转载,请注明出处:https://www.web176.com/cssprop/5560.html
支付宝
微信