简体   繁体   English

IE:边框半径与背景不平滑

[英]IE: border-radius with background is not smooth

I have a styling problem in IE environment. 我在IE环境中遇到样式问题。 When I use border-radius to make a div circle, the border of the circle div is not smooth as chrome or firefox show. 当我使用border-radius制作div圆时,圆形div的边框不如chrome或firefox所示平滑。

Following are the code that I use 以下是我使用的代码

html html

<div class="col-sm-4">
    <div class="circle-images"></div>
</div>

css 的CSS

Padding-top:60% makes div square when you place background image. 顶部填充:放置背景图片时,有60%的像素使div方形。

.circle-images{
   width:60%;
   padding-top:60%;
   border-radius: 60%;  
   margin-right: auto;
   margin-left: auto;
   background: url("some/path/to/jpg") no-repeat center center;
   background-size:contain;
 }

I also tried this style as well. 我也尝试过这种风格。 The border helped a little smoother than without border but it has a lot of noises on the border. 边界比没有边界时更平滑一些,但是边界上有很多噪音。

.circle-images{
  width: 60%;
  padding-top:50%;
  border-radius: 60%;
  border: 27px solid #EAEAE4;
  margin-right:auto;
  margin-left:auto;
  background: url("some/path/to/jpg") no-repeat center center;
  background-size:contain;
}

Is there any way make border smooth as Chrome in IE ? 有什么方法可以像IE中的Chrome一样使边框更平滑?

** update ** Since @LGSon was asking sample images, here is what's happening **更新**由于@LGSon正在询问示例图像,所以这是正在发生的事情

IE noises IE噪音

This is a bug in IE. 这是IE中的错误。 The safest way (but not the easiest) is to make the images them selves circular. 最安全的方法(但不是最简单的方法)是使图像自己变成圆形。 Another solution is to try and use browser specific hacks, but this is very unsafe. 另一个解决方案是尝试使用特定于浏览器的黑客,但这是非常不安全的。

If at all possible, I recommend converting to an image structure like PNG which allows transparency, then making your images circular. 如果有可能,我建议您转换为允许透明的PNG之类的图像结构,然后使图像变为圆形。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM