html - CSS响应边框半径图像

标签 html css image cornerradius

我想通过 CSS 制作一个圆形的图像,但是,当我使用 border-radius: 50%; 时,我的图像变成了椭圆体。

我希望输出带有该图像的响应圆。

我该怎么做?

谢谢!

#image {
  width: 100%;
  border-radius: 50%;
}
<div id="main">
  
  <figure id="img-div">
    <img id="image" src="https://wallpaperaccess.com/full/486693.jpg" alt="A bulb that represent electricity">
  </figure>
  
</div>

最佳答案

您可以通过调整图像大小来做到这一点,只需使图像具有相同的高度和宽度,如下所示。

这只是您可以做到的另一种方式..

#image {
  width: 100%;
  border-radius: 50%;
}
<div id="main">
  
  <figure id="img-div">
    <img id="image" src="/image/q2ola.jpg" alt="A bulb that represent electricity">
  </figure>
  
</div>

关于html - CSS响应边框半径图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57908434/

相关文章:

html - webkit 浏览器上的悬停问题

html - th 内元素的直接父级是行?

html - 在图片下方排列文字

ios - 适用于 iOS 的 gmaps 中的 Google 卫星图像日期

javascript - D3 可折叠树不同节点颜色

html - 一个标签内有两个背景

php - jQuery load() 在不同选项卡上时

html - 如何在保持比例的同时用图像填充 div?

java - 将图像与鼠标单击关联

html - 如何在导航栏右侧 float 链接?