在css中,可以使用border-radius属性为图片设置圆角,只需要给图片元素设置“border-radius:数值;”样式即可。为该属性提供一个值,就能同时设置四个圆角的半径,所有合法的CSS度量值都可以使用。
本教程操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。
CSS3圆角只需设置一个属性:border-radius(含义是边框半径)。你为这个属性提供一个值,就能同时设置四个圆角的半径。所有合法的CSS度量值都可以使用:em、ex、pt、px、百分比等等。
例子:
<!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> <!-- 原图尺寸是:599*531px的 --> <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视频教程
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。