首页 > 解决方案 > 有谁知道为什么 css 在我的 html 中不起作用?

问题描述

有谁知道为什么 css 在我的 html 中不起作用?它链接到我的html,但不起作用。它还在 chrome 检查 - css 选项卡中显示为空。我看到 css 正在链接,但不知道为什么它不工作.. 提前谢谢你!


    <!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Quierra Marriott</title>

      <link rel="stylesheet" href="https://unpkg.com/aos@next/dist/aos.css" />
      <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
      <link rel="stylesheet" type="text/css" href="main.css">
</head>


    * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 10px
    font-family: 'Roboto', sans-serif;
    color: #eee;``
}

body {
    width: 100%;
    height: 100%;
    background: url() no-repeat center fixed;
    background-size: cover;
}

标签: htmlcss

解决方案


您的 CSS 无效:

html {
    font-size: 10px /* You're missing a semi-colon here*/
    color: #eee;`` /* You don't need the strings `` here...*/
...

您可能会对寻找 w3c css 验证器之类的工具感兴趣:https ://jigsaw.w3.org/css-validator/ 。


推荐阅读