首页 > 解决方案 > 网站未检测到我在 SCSS 上创建的形状

问题描述

我正在按照 Web 开发教程创建登录页面。我正在使用 CSS、HTML 和 JS 的组合。我的网站不会检测到我尝试使用 SCSS 绘制的导航栏。它是深蓝色的,位于右上角。以下是到目前为止该项目的代码。

索引.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- displays site properly based on user's device -->

  <link rel="icon" type="image/png" sizes="32x32" href="./images/favicon-32x32.png">
  <link rel="preconnect" href="https://fonts.gstatic.com">
  <link href="https://fonts.googleapis.com/css2?family=Public+Sans:wght@300;400&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="/dist/style.css">
  <title>Frontend Mentor | Easybank landing page</title>

  <!-- Feel free to remove these styles or customise in your own stylesheet  -->
  <style>
    .attribution { font-size: 11px; text-align: center; }
    .attribution a { color: hsl(228, 45%, 44%); }
  </style>
</head>
<body>

  <header class="header">
    <nav class="flex flex-jc-sb">
      <a href="/" class="header__logo">
        <img src="images/logo.svg" alt="Easybank" />
      </a>

      <a href="#" class="header__menu">
        <span></span>
        <span></span>
        <span></span>
      </a>
    </nav>
  </header>

  <div class="attribution">
    Challenge by <a href="https://www.frontendmentor.io?ref=challenge" target="_blank">Frontend Mentor</a>. 
    Coded by <a href="#">Your Name Here</a>.
  </div>

  <script src="/app/js/script.js"></script>
</body>
</html>

样式.scss

@import "variables";
@import "globals";
@import "header";

_globals.scss

hmtl {
    font-size: 100%;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Public Sans', sans-serif;
    line-height: 1.3;
}

/// Flexbox
.flex {
    display: flex;

    &-jc-sb {
        justify-content: space-between;
    }

    &-jc-c {
        justify-content: center;
    }

    &-ai-c {
        align-items: center;
    }
}

_headers.scss

.header {
    nav {
        padding: 24px;
    }

    &__menu { // Mobile Menu

      > span {
          display: block;
          width: 26px;
          height: 2px;
          background-color: $darkBlue;

          &:not(:last-child){
              margin-bottom: 3px;
          }
      }
    }
}

标签: javascripthtmlsassresponsive-design

解决方案


推荐阅读