gpt4 book ai didi

HTML 不加载外部 css

转载 作者:行者123 更新时间:2023-11-28 11:03:48 25 4
gpt4 key购买 nike

此 html 未获取任何 CSS。关于我所缺少的任何帮助 - 谢谢。

fun.html

<!doctype html>
<html lang="en">

<head>
<link href="mainsite.css" rel="stylesheet">
<meta name="keywords" content="HTML, Hyper Text Markup Language," />
<meta charset="UTF-8" />
<meta name="author" content="Miguel Castaneda" />
<meta name="robots" content="all, nofollow" />
<title>Building Blocks to Html</title>
</head>

<body>
<p class="center">THis class was center</p>
<p id="center">This id was centered</p>
<h1>This is h1 text</h1>

</body>


</html>

主站点.css

#nav{
//position: fixed;
/right: 200px;
//top: 200px;
}

.center{
text-align:center;
color:red;

}

center{
text-align:center;
color:red;
}

body{color:blue;}


h1 {color:#00ff00;}

最佳答案

我认为这是链接 css 文件的正确方法,请尝试...

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

确保两个文件都在同一个文件夹中,因为你没有为你的 css 输入路径

还有你的html文件缺少代码的打开

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

关于HTML 不加载外部 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22338776/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com