html - 具有内框/边框描边的 CSS 外层 div 元素

标签 html css box

我正在尝试以下操作。我有一个 div,其中包含一个带有大边框描边的框。这是我一直在玩的代码。

.insta{
  background:#000;
  width:820px;
  height:300px;
  margin-left: auto;
  margin-right: auto;
}
.inner-line{
border:10px solid #fff;
width:88%;
height:300px;
position:relative;
right:20;
left:20;
top:20;
bottom:20;
}

<div class="insta"><div class="inner-line"></div></div>

我得到了这个结果,

enter image description here

我正在尝试将此作为最终结果,

enter image description here

我知道 CSS 提供的框方法,但不知道是否可以使用它来实现。有什么想法或想法吗?

最佳答案

您可以结合使用不使用散布或模糊的框阴影和边框:

CSS

    border: 10px solid white;
    -webkit-box-shadow: 0px 0px 0px 10px rgba(0,0,0,1);
    -moz-box-shadow: 0px 0px 0px 10px rgba(0,0,0,1);
    box-shadow: 0px 0px 0px 10px rgba(0,0,0,1);

JSfiddle

关于html - 具有内框/边框描边的 CSS 外层 div 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25086143/

相关文章:

javascript - HTML 用 JS 获取点击时的坐标/位置

javascript - Window.onbeforeprint 和 Window.onafterprint 同时被解雇

css - 一行中的多个编辑器字段和编辑器标签

javascript - 使用 Box API v2 在 Angular.js 中处理未经授权的请求

html - 仅自动 float CSS?

html - 使用 Bootstrap 列时如何显示完整文本?

html - CSS Flexbox 图像缩小

html - 有没有办法为 div 设置垂直滚动条?

ruby-on-rails - 如何将 css/sass 样式表关联到 Rails 中的 View ?

vagrant - ionic-box vagrant box - 安装 Android 目标 : "android-22"