即使在CSS中更改了背景图片和颜色后,背景仍然保持不变

时间:2019-01-10 08:31:18

标签: css css3 background background-image

我正在尝试在CSS中编辑部分的背景色。当我在Dreamweaver中使用实时视图时,背景显示新颜色。如果我预览页面,它会恢复为原始颜色。如果我使用Safari,Chrome或Firefox查看该页面,则该页面仍显示原始背景色。如何强制背景显示为新颜色?

原始颜色为灰色渐变。出于测试目的,我只是尝试将背景设置为白色。我已将背景颜色更改为白色,并使用background-color和background-image将白色背景放在CSS中。

这是我的html代码:

#banner {
  padding: 10em 0 4.75em 0;
}

#banner .inner {
  margin: 0 auto;
  width: 55em;
}

#banner .logo {
  -moz-transition: opacity 2s ease, -moz-transform 1s ease;
  -webkit-transition: opacity 2s ease, -webkit-transform 1s ease;
  -ms-transition: opacity 2s ease, -ms-transform 1s ease;
  transition: opacity 2s ease, transform 1s ease;
  -moz-transform: translateY(0);
  -webkit-transform: translateY(0);
  -ms-transform: translateY(0);
  transform: translateY(0);
  opacity: 1;
  margin: 0 0 1.3em 0;
}

#banner .logo .icon {
  border-radius: 100%;
  border: solid 2px rgba(255, 255, 255, 0.125);
  cursor: default;
  display: inline-block;
  font-size: 2em;
  height: 2.25em;
  line-height: 2.25em;
  text-align: center;
  width: 2.25em;
}

#banner h2 {
  -moz-transition: opacity 0.5s ease, -moz-transform 0.5s ease, -moz-filter 0.25s ease;
  -webkit-transition: opacity 0.5s ease, -webkit-transform 0.5s ease, -webkit-filter 0.25s ease;
  -ms-transition: opacity 0.5s ease, -ms-transform 0.5s ease, -ms-filter 0.25s ease;
  transition: opacity 0.5s ease, transform 0.5s ease, filter 0.25s ease;
  -moz-transform: translateX(0);
  -webkit-transform: translateX(0);
  -ms-transform: translateX(0);
  transform: translateX(0);
  -moz-transition-delay: 0.65s;
  -webkit-transition-delay: 0.65s;
  -ms-transition-delay: 0.65s;
  transition-delay: 0.65s;
  -moz-filter: blur(0);
  -webkit-filter: blur(0);
  -ms-filter: blur(0);
  filter: blur(0);
  opacity: 1;
  border-bottom: solid 2px rgba(255, 255, 255, 0.125);
  font-size: 2.25em;
  margin-bottom: 0.8em;
  padding-bottom: 0.4em;
  color: black;
}

#banner p {
  -moz-transition: opacity 0.5s ease, -moz-transform 0.5s ease, -moz-filter 0.25s ease;
  -webkit-transition: opacity 0.5s ease, -webkit-transform 0.5s ease, -webkit-filter 0.25s ease;
  -ms-transition: opacity 0.5s ease, -ms-transform 0.5s ease, -ms-filter 0.25s ease;
  transition: opacity 0.5s ease, transform 0.5s ease, filter 0.25s ease;
  -moz-transform: translateX(0);
  -webkit-transform: translateX(0);
  -ms-transform: translateX(0);
  transform: translateX(0);
  -moz-transition-delay: 0.8s;
  -webkit-transition-delay: 0.8s;
  -ms-transition-delay: 0.8s;
  transition-delay: 0.8s;
  -moz-filter: blur(0);
  -webkit-filter: blur(0);
  -ms-filter: blur(0);
  filter: blur(0);
  opacity: 1;
  font-family: Raleway, Helvetica, sans-serif;
  font-size: 1em;
  font-weight: 200;
  letter-spacing: 0.1em;
  line-height: 2;
  text-transform: uppercase;
  color: black;
}

@media screen and (max-width: 1280px) {
  #banner {
    padding: 7em 0 8.25em 0;
    background-color: #FFFFFF;
    background-size: auto, cover;
    background-position: center, center;
    margin-bottom: -6.5em;
    background-image: -webkit-linear-gradient(270deg, rgba(255, 255, 255, 1.00) 0%, rgba(255, 255, 255, 1.00) 99.45%, rgba(0, 101, 162, 1.00) 99.45%), url(../../img/Unknown.png);
    background-image: -moz-linear-gradient(270deg, rgba(255, 255, 255, 1.00) 0%, rgba(255, 255, 255, 1.00) 99.45%, rgba(0, 101, 162, 1.00) 99.45%), url(../../img/Unknown.png);
    background-image: -o-linear-gradient(270deg, rgba(255, 255, 255, 1.00) 0%, rgba(255, 255, 255, 1.00) 99.45%, rgba(0, 101, 162, 1.00) 99.45%), url(../../img/Unknown.png);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 1.00) 0%, rgba(255, 255, 255, 1.00) 99.45%, rgba(0, 101, 162, 1.00) 99.45%), url(../../img/Unknown.png);
  }
}

@media screen and (max-width: 980px) {
  #banner {
    padding: 12em 3em 12.375em 3em;
    margin-bottom: -4.75em;
  }
  #banner .inner {
    width: 100%;
  }
}

@media screen and (max-width: 736px) {
  #banner {
    padding: 5em 2em 4.25em 2em;
    margin-bottom: -2.5em;
  }
  #banner .logo {
    margin: 0 0 1em 0;
  }
  #banner .logo .icon {
    font-size: 1.5em;
  }
  #banner h2 {
    font-size: 1.5em;
  }
  #banner p {
    font-size: 0.8em;
  }
}

body.is-preload #banner .logo {
  -moz-transform: translateY(0.5em);
  -webkit-transform: translateY(0.5em);
  -ms-transform: translateY(0.5em);
  transform: translateY(0.5em);
  opacity: 0;
}

body.is-preload #banner h2 {
  opacity: 0;
  -moz-transform: translateX(0.25em);
  -webkit-transform: translateX(0.25em);
  -ms-transform: translateX(0.25em);
  transform: translateX(0.25em);
  -moz-filter: blur(2px);
  -webkit-filter: blur(2px);
  -ms-filter: blur(2px);
  filter: blur(2px);
}

body.is-preload #banner p {
  opacity: 0;
  -moz-transform: translateX(0.5em);
  -webkit-transform: translateX(0.5em);
  -ms-transform: translateX(0.5em);
  transform: translateX(0.5em);
  -moz-filter: blur(2px);
  -webkit-filter: blur(2px);
  -ms-filter: blur(2px);
  filter: blur(2px);
}
<section id="banner">
  <div class="inner">
    <div class="logo"><img src="img/World Valve Logo Trans copy.png" alt="Logo"></div>
    <h2>ワールドバルブ株式会社 <br> Imagination & Creativity</h2>
    <p>我々ワールドバルブ株式会社は、多様化する市場のニーズに応えていくと共に、 流体制御における様々な機器、機材の供給を通じ、 社会、環境の発展に貢献し続けていきます。</p>
  </div>
</section>

我希望本节的背景现在为白色,但仍保持原始的灰色渐变。任何可能造成这种情况的帮助将不胜感激。

0 个答案:

没有答案