繁体   English   中英

CSS3 未链接到 HTML5?

[英]CSS3 not linking to HTML5?

谁能告诉我为什么我的样式表不会链接到我的 html 文本? 我觉得我已经在阳光下尝试了一切,现在只是茫然地盯着它。 这可能是非常明显的事情。

 h2 { font-family: sans-serif; text-align: center; color: blue; } p { font-family: sans-serif; }
 <.DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> Konrad Zuse </title> <link rel="stylesheet" type="text/css" href="stylesheet.css" media="screen" /> </head> <h2> Konrad Zuse </h2> <p> Konrad Zuse was a German computer scientist who is responsible for creating the worlds first programmable computer, </p> <p> He also designed the first high-level programming language. Plankakül, </p> <p> Born on the 22<sup>nd</sup> of June 1910 in Berlin his family moved to Braunsberg, now know as Braniewo. Poland. His father worked as a postal clerk whilst Zuse attended Collegium Hosianum, Zuse passed his Abitur in 1928. meaning he could go on to study at university, Attending the Technische Hochschule Berlin, now Technical University of Berlin. Zuse studied engineering and architecture both of which he found tedious. He began a path down civil engineering and graduated in 1935. Once graduated Zuse began work at the Henschel aircraft factory in Berlin. He was made to calculate routine maths by hand and started to think up a machine that would do his calculations for him. </p>

您的代码中缺少<body></body>标记。 最后还有</html>

希望能帮助到你;-)

这里有一些提示。

当您加载页面时,右键单击页面和 go 到Inspect element 然后 go 到Network选项卡,单击CSS复选框并刷新页面。 它将显示它尝试加载的 css。 如果文件名是白色的,则加载 CSS。 如果不是,则可能是路径问题。 如果您可以从控制台发布“ Network选项卡的图像,那就太酷了

还。 您缺少<body></body>和关闭</html>标记。 先处理好这个

为了让您的 css 链接到您的 HTML 文件,您需要有正确的路径。 如果您将 css 文件链接为stylesheet.css 8CBA22E28EB17B5F5C6AE2A266AZ,那么您需要将两个文件放在同一个文件夹中(如下所示)

如果您想使用 html 文件中没有的 css 文件,则需要从 html 文件开始您的路径。 例如,如果您的index.html在父文件夹中,您的stylesheet.css 8CBA22E28EB17B5F5C6AE2A266AZ 在子文件夹中,您的路径将是href="/resources/stylesheet.css" (如下所示)

最后,如果您的stylesheet.css 8CBA22E28EB17B5F5C6AE2A266AZ 将在父文件夹中,那么您需要将 go 加上..这意味着 go 回到父文件夹。 您的路径将是href="../stylesheet.css"您的 html 文件仍然是起点。

 <html> <body> <div class="p">stuff</div> </body> </html>

这可能不是问题,我对 html 也有点陌生,但也许可以尝试这样做,例如使用 ur.p

我想你必须使用 div function 来调用 css 块

暂无
暂无

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

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