使用css将图像显示为带圆圈的图像

San*_*rst 6 html css

这是我的代码 - 这适用于chrome,firefox和safari ..我在Windows 7上测试过它但是在IE 8和Opera浏览器中,下面的代码不起作用而不是显示带圆圈的图像我得到的是方形图像

<div id="hotspot-img1-0">
  <ul>
    <img class="proimg" src="http://profile.ak.fbcdn.net/hprofile-ak-snc4/276311_100002617687873_1118195351_n.jpg" title="web" style="width:100px;height:100px;background:#fff;border:2px solid #ccc;-moz-border-radius:52px;-webkit-border-radius:52px;">
  </ul>
</div>

CSS

#hotspot-img1-0{
top: 570px; 
left: 67px; 
height: 104px; 
width: 104px; 
border-top-left-radius: 52px; 
border-top-right-radius: 52px; 
border-bottom-right-radius: 52px; 
border-bottom-left-radius: 52px; 
box-shadow: 0px 2px 5px 0px; 
border-top-color: rgb(255, 255, 255); 
border-left-color: rgb(255, 255, 255); 
border-right-color: rgb(255, 255, 255); 
border-bottom-color: rgb(255, 255, 255); 
border-top-width: 2px; 
border-left-width: 2px; 
border-right-width: 2px; 
border-bottom-width: 2px; 
border-top-style: solid; 
border-left-style: solid; 
border-right-style: solid; 
border-bottom-style: solid
}
Run Code Online (Sandbox Code Playgroud)

san*_*eep 9

@Sandhurst; 坏标记写的第一件事就像这样:

<div>
  <ul>
    <li>
       <img class="proimg" src="http://profile.ak.fbcdn.net/hprofile-ak-snc4/276311_100002617687873_1118195351_n.jpg" title="web">
    </li>
  </ul>
</div>
Run Code Online (Sandbox Code Playgroud)

和问题的答案background-image代替img :

li{
 background:url(image.jpg) no-repeat;
 -moz-border-radius:52px;
 -webkit-border-radius:52px;
 border-radius:52px;
width:200px;
height:200px;
}
Run Code Online (Sandbox Code Playgroud)

  • 为了适合div里面的图像写-moz-background-size:100%100%; -webkit-background-size:100%100%; (2认同)