为什么我的幻灯片背景图像没有显示?

时间:2019-03-17 17:30:04

标签: html css

为什么我的幻灯片背景图像没有显示?问题不在于文件路径,而在于编码。

当一张幻灯片出现时,由于图像未显示,因此我现在无法显示白色背景。

/* Styling and fetching IMG */

.slide-1 {
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0.65)), url('media/image/slider/audi-black-car-8639.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
<div id="rev_slider_wrapper" class="rev_slider_wrapper fullwidthbanner-container">
  <div id="rev_slider" class="rev_slider fullwidthabanner" style="display:none;" data-version="5.0.7">
    <ul>
      <li data-index="slide-1" data-transition="fade" data-slotamount="1" data-easein="default" data-easeout="default" data-masterspeed="500" data-rotate="0" data-delay="6000">
        <img class="pic_slide_one" alt="slide-1" data-bgfit="cover" data-bgposition="center bottom">

1 个答案:

答案 0 :(得分:0)

检查以下代码,可以正常工作。请在html中将css添加到class属性,并确保显示为块而不是无。

.slide-1 {
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0.65)), url('media/image/slider/audi-black-car-8639.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
<div id="rev_slider_wrapper" class="rev_slider_wrapper fullwidthbanner-container">
  <div id="rev_slider" class="rev_slider fullwidthabanner" style="display:block;" data-version="5.0.7">
    <ul>
      <li class ="slide-1" data-index="slide-1" data-transition="fade" data-slotamount="1" data-easein="default" data-easeout="default" data-masterspeed="500" data-rotate="0" data-delay="6000">
        <img class="pic_slide_one" alt="slide-1" data-bgfit="cover" data-bgposition="center bottom">