html - 圆形可点击个人资料图像,底部有一个按钮在 css 中

标签 html css twitter-bootstrap-3

enter image description here enter image description here我想制作一个圆形的可点击个人资料图片,底部有一个按钮。我可以为普通图像执行此操作,但是当涉及到圆形图像时,按钮将占用该图像和按钮可用的容器的大小。 谢谢

.img-circle {
  border-radius: 50%;
}
<div class="img-thumbnail img-circle">
  <div style="position: relative; padding: 0; cursor: pointer;" type="file">
    <img class="img-circle" style="width: 140px; height: 140px;" >
    <span style="position: absolute; color: red; bottom: 20px; left: 40px;">UPLOAD</span>
  </div>
</div>

最佳答案

好的。看这里。我想我明白你想要达到的目标。 让我知道是否有帮助

注意:img.img-circle {background:black; } 仅用于示例目的,因此您可以看到 img 应该在哪里。在你的代码中你不必包含这个

.img-circle {
  border-radius: 50%;
}
img.img-circle {
  background:black;
}
span {
 left:0;
 text-align:center;
 width:100%;
 background:rgba(255,255,255,0.5);
 bottom:0;
 padding:20px 0;
}
.img-thumbnail {
border-radius: 0;
display:inline-block;
background:#dbdbdb;
padding:20px;
 }
.img-thumbnail > div {
display:inline-block;
overflow: hidden;
height: 140px;
border: 5px solid #fff;
-webkit-box-shadow: 0 2px 0 2px #333;
box-shadow: 0 2px 0 2px #333;
border-radius:50%;
}
<div class="img-thumbnail img-circle">
  <div style="position: relative; padding: 0; cursor: pointer;" type="file">
    <img class="img-circle" style="width: 140px; height: 140px;" >
    <span style="position: absolute; color: red; ">UPLOAD</span>
  </div>
</div>
<div class="img-thumbnail img-circle">
  <div style=" position: relative;padding: 0; cursor: pointer;" type="file">
    <img class="img-circle" style="width: 140px; height: 140px;" >
    <span style="position: absolute; color: red; ">UPLOAD</span>
  </div>
</div>

关于html - 圆形可点击个人资料图像,底部有一个按钮在 css 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38367110/

相关文章:

html - 将溢出元素围绕其容器居中

css - 当父 DIV 具有最小高度时,无法在子 DIV 中使用百分比高度吗?

html - 如何使用 Angular 复选框更改 div 类

jquery - Bootstrap 3 col等高,内容动态且不均匀

php - 防止用户打开同一网站的多个实例

javascript - 如何使用 jquery 创建图像缩放效果?

css - 双破折号 webkit 前缀——chrome 中的 webkit,单个不工作

javascript - 单击图像映射并在 Bootstrap 中打开模式窗口

javascript - 根据窗口大小动态调整div

HTML 在方形网格图片中指定分隔线间隙测量