html - 带有偏移的图像上的双内边框

标签 html css image border

我正在尝试使用 CSS 在图像上重新创建这些边框。

enter image description here

我已经能够使用此 CSS 创建一个边框:

.bordered-image {
  position: relative;
  outline: 1px double white;
  outline-offset: -10px;
}

但我一直无法创建第二个边框。可以使用CSS吗?

最佳答案

希望下面的代码有帮助

enter image description here

body{
   padding:50px;
}
.box{
  width:300px;
  height:200px;
  border:1px solid red;
  position:relative;
}
.box:after{
  content:"";
  position:absolute;
  top:-4px;
  bottom:-4px;
  left:2px;
  right:2px;
  border:1px solid green;
}
<div class="box" >
</div>

关于html - 带有偏移的图像上的双内边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46599248/

相关文章:

javascript - 如何使用 jQuery 添加另一个对象的高度作为边距?

html - 用于 wordpress 的嵌入式播放器和图像内容

c++ - OpenCV : convert the pointer in memory to image

c# - C# 中的图像转换

html - IE 图像子域问题

html - 如何在 ReactJS 中将元素放置在 div 中?

jquery - 使用jqueryeach()和hover()选择多个id并悬停

html - 离开选项卡时如何清理我的表单

javascript - 设置overflow-y可见,而overflow-x为auto,以便内容可以垂直溢出父容器

css - 有没有办法创建一个带有渐变和圆 Angular 边框的按钮(或 div)?