html - 内容覆盖的盒子阴影?

标签 html css

我有一个带有框阴影的 div,看起来很棒。我遇到的问题是,当我向 div 添加内容时,内容将覆盖阴影。如何在我的 div 上添加框阴影并将其置于该 div 的任何子内容之上?

这是在包含的 div 上设置的 css

    #hero_graphic {
        box-shadow: inset 0px 5px 10px #333;
        float: left;
        width: 100%;
        height: 300px;
        margin: 0px;
        padding: 0px;
    }

如果 div 中没有内容,但当我向 div 添加内容时,此插图框阴影将显示。

最佳答案

你想告诉内容行为并保持它与阴影的距离,将 #hero_graphicpadding 设置为大约 15 像素。

See example

关于html - 内容覆盖的盒子阴影?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10620440/

相关文章:

html - 在 Bootstrap 模态中使用 'react-day-picker' DatePickerInput

jquery - 为什么剩下:auto; right:auto not centering a div?

php - 只想使用 PHPExcel 从 excel 文件打印单元格数据?

CSS:用形状创建背景?

jquery - 显示两个 DIV 弹出窗口而不是一个

html - iFramed 页面的 CSS 未正确应用

HTML5 <audio> 不适用于 Firefox,即使我使用 .ogg

javascript - 使用javascript取消注释html代码

html - CSS: display: inline-flex 和 text-overflow: ellipsis 不能一起工作

html - 3个div没有对齐