【问题标题】:Internet explorer <td> background image only shows where there's contentInternet explorer <td> 背景图片只显示有内容的地方
【发布时间】:2016-05-04 04:33:35
【问题描述】:

第一次,好久不见。

我对单元格的背景图片有疑问。它在 Chrome 和 Firefox 中运行良好。但是,我的问题仅在使用 IE 时会出现。

在 IE 中,它只会在单元格中有内容的地方显示背景图片。例如,如果文本仅填满单元格的一半,则背景将仅显示在单元格的一半下方。无论那里是否有内容,我都需要它显示完整的背景。提前感谢您的任何帮助。

这是我的 CSS:

.game{
    width: 40%;
    max-width: 40%;
    min-width: 40%;
    display: block;
    position: relative;
}


.game:after {
  content: "";
  background-image: url('image.jpg') !important;
  opacity: 0.45;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  position: absolute;
  z-index: -1;   
}

【问题讨论】:

标签: html css internet-explorer


【解决方案1】:

empty-cells 属性在这里应该有所帮助:

empty-cells CSS 属性指定用户代理应如何在没有可见内容的单元格周围呈现边框和背景。

所以为您的表格单元格元素添加empty-cells: show;

【讨论】:

猜你喜欢
  • 2017-06-27
  • 1970-01-01
  • 2011-12-07
  • 1970-01-01
  • 1970-01-01
  • 2015-01-22
  • 2023-03-07
  • 2012-03-18
  • 2018-05-29
相关资源
最近更新 更多