【问题标题】:my html is not linking with my css on chrome os我的 html 没有链接到我在 chrome 操作系统上的 css
【发布时间】:2022-11-21 15:29:59
【问题描述】:

我的代码没有链接到我的 css

<!DOCTYPE html>
<html>
<head>
    <link href="main.css" rel="slylesheet" text="text/css">
<title></title>
</head>
<body>
    <header>
        <div class="container">
            <img src="beens.jpg" alt="logo" class="logo">
            <nav>
                <ul>
                    <li><a href="#">about</a></li>
                    <li><a href="#">games</a></li>
                    <li><a href="#">contact</a></li>
                    <li><a href="#">blog</a></li>
                </ul>
            </nav>
        </div>
        
    </header>
</body>
</html>

它在我的闪存驱动器上有效,但在本地无效

.container {
    width: 80%;
    margin: 0 auto;
}
.header {
    background: rgb(51, 146, 153);
}
li {
  color: rgb(142, 15, 15);
}

我的背景还是白色请帮忙

我尝试重写我的链接代码并在此处检查

【问题讨论】:

  • 你能提供这个项目的目录结构的截图吗?

标签: html css google-chrome-os


【解决方案1】:

像这样尝试,

.container {
    width: 80%;
    margin: 0 auto;
}
header {
    background: rgb(51, 146, 153);
}
li {
  color: rgb(142, 15, 15);
}
<!DOCTYPE html>
<html>
<head>
    <link href="main.css" rel="slylesheet" text="text/css">
<title></title>
</head>
<body>
    <header>
        <div class="container">
            <img src="beens.jpg" alt="logo" class="logo">
            <nav>
                <ul>
                    <li><a href="#">about</a></li>
                    <li><a href="#">games</a></li>
                    <li><a href="#">contact</a></li>
                    <li><a href="#">blog</a></li>
                </ul>
            </nav>
        </div>
        
    </header>
</body>
</html>
 

【讨论】:

    【解决方案2】:

    你这里有错字:&lt;link href="main.css" rel="slylesheet" text="text/css"&gt;

    应该是stylesheet

    你也把你的标题称为类.header 但是因为你没有给它一个类并且想要调用你需要将它设置为的标签

    header {
        background: rgb(51, 146, 153);
    }
    

    【讨论】:

      猜你喜欢
      • 2020-09-01
      • 2015-05-02
      • 2018-06-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多