CSS 样式未应用,或应用后消失

问题描述 投票:0回答:1

文字颜色和背景不变。在其他项目上,一切都完全失败了

更新F5页面和CTRL + F5没有帮助。在 VS code 中运行 Open live server 时,它显示更改先应用,然后消失:

* {
  font-family: "Comfortaa", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
}

html,
h1,
h2,
h3,
h4,
h5,
h6 {
  color: #5c5959;
}

body {
  background: #f6f6f6;
}
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
<link href='https://unpkg.com/[email protected]/css/boxicons.min.css' rel='stylesheet'>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Comfortaa:[email protected]&display=swap" rel="stylesheet">

<header class="container-fluid">
  <div class="container">
    <div class="row">
      <div class="col-4">
        <h1>My site</h1>
      </div>
      <nav class="col-8">
        <ul>
          <li><i class='bx bxs-home'></i><a href="#">Главная</a></li>
          <li><i class='bx bxs-bowl-hot'></i><a href="#">Услуги</a></li>
          <li>
            <i class='bx bxs-user'></i><a href="#">Кабинет</a>
            <ul>
              <li>
                <a href="#">Админ панель</a>
              </li>
              <li><a href="#">Выход</a></li>
            </ul>
          </li>
          <li><i class='bx bxs-phone'></i><a href="#">О нас</a></li>
        </ul>
      </nav>
    </div>
  </div>
</header>

html css bootstrap-5
1个回答
0
投票

您的样式正在被框架覆盖,如果我们删除外部资源,您可以看到样式正在被应用:

* {
  font-family: "Comfortaa", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
}

html,
h1,
h2,
h3,
h4,
h5,
h6 {
  color: #5c5959;
}

body {
  background: #f6f6f6;
}
<header class="container-fluid">
  <div class="container">
    <div class="row">
      <div class="col-4">
        <h1>My site</h1>
      </div>
      <nav class="col-8">
        <ul>
          <li><i class='bx bxs-home'></i><a href="#">Главная</a></li>
          <li><i class='bx bxs-bowl-hot'></i><a href="#">Услуги</a></li>
          <li>
            <i class='bx bxs-user'></i><a href="#">Кабинет</a>
            <ul>
              <li>
                <a href="#">Админ панель</a>
              </li>
              <li><a href="#">Выход</a></li>
            </ul>
          </li>
          <li><i class='bx bxs-phone'></i><a href="#">О нас</a></li>
        </ul>
      </nav>
    </div>
  </div>
</header>

© www.soinside.com 2019 - 2024. All rights reserved.