CSS-轮廓(outline)

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

轮廓(outline)属性指定了样式,颜色和外边框的宽度。


属性说明版本
outline设置所有的外边框属性outline-color
outline-style
outline-width
inherit
2
outline-color设置外边框的颜色color-name
hex-number
rgb-number
invert
inherit
2
outline-style设置外边框的样式none
dotted
dashed
solid
double
groove
ridge
inset
outset
inherit
2
outline-width设置外边框的宽度thin
medium
thick
length
inherit
2


1 轮廓样式

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>轮廓样式</title>
<style>
p {border:1px solid red;}
p.dotted {outline-style:dotted;}
p.dashed {outline-style:dashed;}
p.solid {outline-style:solid;}
p.double {outline-style:double;}
p.groove {outline-style:groove;}
p.ridge {outline-style:ridge;}
p.inset {outline-style:inset;}
p.outset {outline-style:outset;}
</style>
</head>

<body>
<p class="dotted">A dotted outline</p>
<p class="dashed">A dashed outline</p>
<p class="solid">A solid outline</p>
<p class="double">A double outline</p>
<p class="groove">A groove outline</p>
<p class="ridge">A ridge outline</p>
<p class="inset">An inset outline</p>
<p class="outset">An outset outline</p>
<p><b>注意:</b> 如果只有一个!DOCTYPE则指定IE8支持 outline属性。</p>
</body>
</html>

2 轮廓颜色

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>轮廓颜色</title>
<style>
p{
border:1px solid red;
outline-style:dotted;
outline-color:#99FF00;}
</style>
</head>

<body>
<p>文本</p>
</body>
</html>

3 轮廓宽度

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>轮廓宽度</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">文本1</p>
<p class="two">文本2</p>
</body>
</html>



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Swxctx

您的鼓励将是我创作的最大动力!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值