html - CSS3 : Box shadow just like in the image

标签 html css

我有一张图片。我想要像图像中一样的框阴影。

我试过下面的代码。

Box Shadow Image

.main_div{
  height:260px;
  width:300px;
  
  -moz-box-shadow: 0px 3px 8px rgb(67, 176, 238);
        -webkit-box-shadow: 0px 3px 8px rgb(67, 176, 238);
        box-shadow: 0px 3px 8px rgb(67, 176, 238);
}
<div class="main_div"></div>

我不希望 box-shadow 置顶。

任何帮助都会很棒。

谢谢。

最佳答案

您可以添加多个框阴影,因为您不希望它位于顶部,因此您可以按如下方式设置每一侧的样式,

box-shadow 的语法,

box-shadow:offset-x | offset-y | blur-radius | spread-radius | color

.main_div {
  height: 260px;
  width: 300px;
  margin: 50px;
  box-shadow: 0px 12px 10px -5px rgba(67, 176, 238, 1), 10px 12px 10px -5px rgba(67, 176, 238, 1), -10px 12px 10px -5px rgba(67, 176, 238, 1);
}
<div class="main_div"></div>

关于html - CSS3 : Box shadow just like in the image,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45183583/

相关文章:

html - 为什么在删除其父包装元素的属性 "position:relative"时页脚元素位置错误

html - 为什么此 css 不将此表单上的提交按钮居中?

css - 在 SASS 中导入 Font Awesome 并使用 uni 代码将图标应用于元素

html - 如何使边框集中在 css 的菜单下?

html - 使用 flex 使容器全宽

javascript - 从没有名称和 ID 值的元素分离 CK 编辑器

html - css 文件上的颜色不起作用

html - 撇号转换为 & # 039 ;在 Twig 上

html - 在绝对 div 中使用 Z-index 和定位文本来创建水印

html - 三 Angular 形图像