【问题标题】:HTML does not respond to the stylesheet [duplicate]HTML 不响应样式表 [重复]
【发布时间】:2017-05-20 06:45:30
【问题描述】:

我不知道为什么我的 html 不响应我的样式表。请帮忙! html 和样式表都在同一个文件夹中。

<!DOCTYPE html>
<html>
<head>
<title>First try</title> 
<link type=“text/css” rel=“stylesheet” href=“stylesheet.css”/>
</head>
<body>
<h1>My first html </h1>
<p>I wish it works!</p>
</body>

</html>

【问题讨论】:

  • 您的报价 - 至少在本例中 - 不是实际报价。另外,你的样式表和你的页面在同一个文件夹中吗?
  • 我要检查的第一件事是我在 type=“text/css” 等中看到的花哨的引号。
  • 不要在 Word 上“编码”...
  • 如果您确实需要编码,请使用支持 UTF-8 编码的纯文本编辑器。在 Windows 中,Notepad++ (notepad-plus-plus.org) 可能是您最初最好的免费镜头。在 macOS 中,来自 App Store 的 TextWrangler 与此类似。对于 GNU/Linux...呃...基本上所有内容,可能是 Gedit 或等效的。

标签: html css


【解决方案1】:

很简单,因为你所有的大括号“ ”。

将它们更改为常规引号"。

并且不要使用 Word 来编码(或类似的处理软件),使用代码编辑器。

编辑:

因此,作为对您的(免费)服务;完全如图所示复制/粘贴:

<!DOCTYPE html>
<html>
    <head>
        <title>First try</title> 
        <link type="text/css" rel="stylesheet" href="stylesheet.css"/>
    </head>
    <body>
        <h1>My first html</h1>
        <p>Now it works!</p>
    </body>

</html>

CSS: (stylesheet.css)

body {

    font-family: Georgia;

}

【讨论】:

  • 我发布了这个,因为我觉得代表不应该来自这个。
猜你喜欢
  • 2021-05-03
  • 2021-07-02
  • 2023-03-06
  • 1970-01-01
  • 2021-09-20
  • 1970-01-01
  • 2015-11-07
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多