简体   繁体   English

外部CSS样式表不起作用

[英]External CSS Stylesheet not working

I have no idea why this HTML file is not formatted with the linked stylesheet: 我不知道为什么该HTML文件未使用链接的样式表进行格式化:

<!DOCTYPE html>
<html>
    <head>
        <title>Sticky Notes</title>
        <link rel=“stylesheet” href=“s.css” type=“text/css”/>
    </head>

    <body>
        <div class=“yellow”>
            <p>Make sticky notes with HTML/CSS.</p>
        </div>
    </body>
</html>

The document path -- I have a folder StickyNotes with the files "s.css" and the above HTML file "sticky.html". 文档路径-我有一个StickyNotes文件夹,其中包含文件“ s.css”和上述HTML文件“ sticky.html”。

Here is the CSS: 这是CSS:

div {
    width: 150px;
    height: 150px;
    border: 2px solid #000000;
}
.yellow {
    background-color: #edeeb4;

}
.pink {
    background-color: #eeb4b4;

}
.green {
    background-color: #b4eec6;

}
.blue {
    background-color: #b4c0ee;
}
.grey {
    background-color: #dddee7;

}

Try using this code: 尝试使用以下代码:

<link rel="stylesheet" href="s.css">

Its the more modern format. 它是更现代的格式。 Also make sure that your css is not in another folder, in which case you'll also need to specify the folder path. 还要确保您的css不在另一个文件夹中,在这种情况下,您还需要指定文件夹路径。

问题是您的双引号使用以下代码:

<link rel="stylesheet" type="text/css" href="s.css">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM