簡體   English   中英

CSS背景圖像未在chrome中顯示,但在vs live服務器上工作

[英]css background images are not showing in chrome but working on vs live server

我試圖用 chrome 顯示圖片,但沒有顯示。 它在 vs live 服務器中可見,但在 chrome 中不可見。

當我使用/它適用於vs live服務器但在其他瀏覽器中背景不起作用

你能幫忙解決這個問題嗎

這是代碼:

html:

     <nav id="navbar" class="navbar">
        <ul>
          <li><a class="nav-link scrollto active" href="#hero">Home</a></li>
          <li><a class="nav-link scrollto" href="#about">About</a></li>
          <li><a class="nav-link scrollto" href="#services">Services</a></li>
          <li><a class="nav-link scrollto" href="#contact">Contact</a></li>
          <li><a class="getstarted scrollto" href="indexAR.html">العربيه</a></li>
        </ul>
        <i class="bi bi-list mobile-nav-toggle"></i>
      </nav><!-- .navbar -->

    </div>
  </header><!-- End Header -->

  <!-- ======= Hero Section ======= -->
  <section id="hero">
    <div class="hero-container" data-aos="fade-up" data-aos-delay="150">
      <h1>Plan. Launch. Grow.</h1>
      <h2>We hope to create a world where our descendants can enjoy a sustainable future</h2>
      <div class="d-flex">
        <a href="#about" class="btn-get-started scrollto">Get Started</a>
      </div>
    </div>
  </section><!-- End Hero --> 

CSS:

#hero {
  width: 100%;
  height: 100vh;
  background: url("/assets/img/5secondhome_lon_ii_sca_8820.png") top center;
  background-size: cover;
  position: relative;
  padding: 0;
}

我相信問題來自<link>元素。

如果您的<link>具有以period .點開頭的src屬性。 在這樣的relative slash之前:

<link rel="stylesheet" href="./css/style.css">

嘗試在沒有period .

<link rel="stylesheet" href="/css/style.css">

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM