在css中,可以使用border-radius属性为图片设置 圆 角,只需要给图片元素设置“border-radius:数值;”样式即可。为该属性提供一个值,就能同时设置四个圆角的 半 径,所有合法的CSS度量值都可以使用。
本教程操作环境:windows7系统、CSS3 && HT ML 5版、Dell G3 电 脑。
CSS3圆角只需设置一个属性:border-radius(含义是"边框半径")。你为这个属性提供一个值,就能同时设置四个圆角的半径。所有合法的CSS度量值都可以使用:em、ex、pt、px、百分比 等等 。
例子:
<!DOCTY PE html> <html> <head> <base t arg et="_self"> < ;m eta http-equiv="Content -t ype" content="text/html; charset=utf-8" /> <meta http-equiv=" PR agma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache,must-ridate"> <meta http-equiv="e xp ires" content="0"> <t IT le>设置背景圆角</title> <link rel="stylesheet" type="text/css" hr ef="bootstrap/bootstrap.min.css" /> <style type="text/css"> .normal{ background -i mage: url(images/rest.png); width: 215px; h ei ght: 215px; border-radius: 50%; background-size : 215px; background-repeat: no-repeat; background-position-y: 9%; } </style> </head> <body> <!-- 原图 尺寸 是:599*531px的 --> <div></div> <script type="text/javascript" src=" jq uery/jquery.min.js"></script> <script type="text/javascript" src="bootstrap/bootstrap.min.js"></script> </body> </html>
原图:
设置背景之后的效果:
推荐学习:css视频教程
以上就是css如何为图片设置圆角的详细内容,更多请关注其它相关 文章 !
总结
以上是 为你收集整理的 css如何为图片设置圆角 全部内容,希望文章能够帮你解决 css如何为图片设置圆角 所遇到的问题。
如果觉得 网站内容还不错, 推荐好友。
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did200085