html - border-bottom 长度小于 border-right?

标签 html css

Border-bottom长度小于border-right怎么办?

img {
    border-bottom: 5px solid #02a8d8;
    border-right:1px solid  rgb(102, 102, 102);
    padding-right: 10px;
}

最佳答案

你必须使用 :after并设置您希望 border-bottom 具有的宽度,然后将其定位为 position: absolutebottom: 0。像这样的东西

.image {
  border: 1px solid black;
  border-bottom: none;
  position: relative;
  display: inline-block;
  box-sizing: border-box;
}

.image img {
  width: 100%;
  float: left;
}

.image:after {
  position: absolute;
  bottom: 0;
  width: 60%;
  border-top: 1px solid black;
  content: "";
  left: 50%;
  transform: translateX(-50%);
}
<div class="image">
  <img src="http://placehold.it/350x160">
</div>

关于html - border-bottom 长度小于 border-right?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34597199/

相关文章:

javascript - 使用 html 输入文件多个选择文件后的事件

html - 如何在网格中的图像上放置文本

css - css 下拉菜单的 z-index 问题

javascript - 背景图像与滚动内容一起移动

javascript - 如何使 javascript 形状看起来与图像中的形状相同以及如何在动画结束后清除 javascript Canvas 形状?

javascript - 如何正确使用SVG checkintersection()函数?

javascript - 为什么 Google Places API 不执行我的请求?

html - 显示从 MySQL 数据库中检索到的 HTML

javascript - 通过 jQuery 对选择下拉列表进行排序?

Javascript 背景颜色转换并在 HTTP 响应上重置