本文摘自PHP中文网,作者醉折花枝作酒筹,侵删。
在css中,可以使用border-radius属性为图片设置圆角,只需要给图片元素设置“border-radius:数值;”样式即可。为该属性提供一个值,就能同时设置四个圆角的半径,所有合法的CSS度量值都可以使用。

本教程操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。
CSS3圆角只需设置一个属性:border-radius(含义是"边框半径")。你为这个属性提供一个值,就能同时设置四个圆角的半径。所有合法的CSS度量值都可以使用:em、ex、pt、px、百分比等等。
例子:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | <!DOCTYPE html>
< html >
< head >
< base target = "_self" >
< meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" />
< meta http-equiv = "pragma" content = "no-cache" >
< meta http-equiv = "cache-control" content = "no-cache,must-ridate" >
< meta http-equiv = "expires" content = "0" >
< title >设置背景圆角</ title >
< link rel = "stylesheet" type = "text/css" href = "bootstrap/bootstrap.min.css" />
< style type = "text/css" >
.normal{
background-image: url(images/rest.png);
width: 215px;
height: 215px;
border-radius: 50%;
background-size: 215px;
background-repeat: no-repeat;
background-position-y: 9%;
}
</ style >
</ head >
< body >
< div ></ div >
< script type = "text/javascript" src = "jquery/jquery.min.js" ></ script >
< script type = "text/javascript" src = "bootstrap/bootstrap.min.js" ></ script >
</ body >
</ html >
|
原图:
阅读剩余部分
相关阅读 >>
css如何为图片设置圆角
更多相关阅读请进入《css背景图片圆角》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » css如何为图片设置圆角