border-radius就可以做到了,
圆形,就把四个角都设置成宽高的一半,就是50%,或者是固定值,,
注意的是,如果你是直接用Img标签的话,那你的Img
宽高要一样,就是说要是正方形,
如果你是通过容器来实现的话,你就直接把容器设置成正方形,border-radius:50%然后再background图片就可以了。
html5 css3样式图标制作方法:
1、html代码:
<div id="boxes">
<div id="boxShortcode">border-radius: 40px (shortcode)</div>
<div id="box1">border-top-right-radius: 40px (same on both axis)</div>
<div id="box2">border-top-right-radius: 20px 40px (x <y) </div>
<div id="box3">border-top-right-radius: 40px 20px (x >y) </div>
</div>
2、css样式代码:
#boxes div { margin-bottom: 20pxheight: 50pxpadding-left: 20px }
#boxShortcode {
background: cyan
border-radius: 40px
}
#box1 {
background: red
border-top-right-radius: 40px
}
#box2 {
background: yellow
border-top-right-radius: 20px 40px
}
#box3 {
background: lime
border-top-right-radius: 40px 20px
}
3、运行结果:
需要准备的材料分别有:电脑、浏览器、html编辑器。
1、首先,打开html编辑器,新建html文件,例如:index.html。
2、在index.html中的<style>标签中,输入css代码:body{background: url(image.jpg) no-repeatbackground-size: 200px 200px}。
3、浏览器运行index.html页面,此时背景图片成功被设定为200*200。