css - 除了某个 div 之外的图像发光

标签 css twitter-bootstrap

所以我的图像上有一个橙色的光,除了包含标题的底部 div 之外,我希望它无处不在。

它是如何构建的简化版本

<div class="navbar-header"> <!-- Has a background image in css which is the base image -->
    <div class="glow-orange"> <!-- Has a background color: rgba(247, 147, 29, 0.4) -->
        <div class="title"> <!-- Is being positioned bottom in the middle -->
            Title
        </div>
    </div>
</div>

这是一个非常简单的图像,用于可视化此设置。蓝色将是我的形象与辉光。它们的灰色条是透明的。我希望灰色条后面的图像部分是图像的原始颜色,而不是橙色发光。

Visualization

提前致谢。

附言我正在使用 bootstrap 框架,它可能具有一些使这更容易/可行的功能。

最佳答案

一个选择是在标题上使用大型 box-shadow 并在父元素上使用 overflow: hidden

.navbar-header {
  width: 250px;
  height: 150px;
  background: url('http://www.lenntech.com/images/Home/Waterdrop775.png');
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.glow-orange {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 100%;
}
.title {
  width: 150px;
  text-align: center;
  height: 50px;
  box-shadow: 0px 0px 0px 150px rgba(247, 147, 29, 0.4);
}
<div class="navbar-header">
  <div class="glow-orange">
    <div class="title">Title</div>
  </div>
</div>

关于css - 除了某个 div 之外的图像发光,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39245252/

相关文章:

php - 使用 iframe 全屏时 Bootstrap 一页主题不适用于嵌入视频

javascript - 只显示固定元素上方的背景图像/颜色

css - 仅使用 css 创建多条均匀间隔的水平线

html - Twitter Bootstrap 在 Internet Explorer 中无法正确显示

javascript - 仅当在下拉菜单外单击鼠标时才关闭 Bootstrap 下拉菜单

javascript - 如何通过 Bootstrap 日期时间选择器使用今天和明天按钮?

html - 鼠标悬停时,CSS 按钮没有响应

css - Font-awesome Pro 5.3.1 在所有 ie 浏览器 ie11、ie10 加载后消失

jquery - Google Map API v3 包含在模板中时消失

javascript - Twitter Bootstrap 使用 "Collapse"插件扩展文本