忍受我,我是Web编程的新手。
这是我的简单代码:
<?xml version='1.0' encoding='UTF-8' ?>
<!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>
<link rel="stylesheet" type="text/css" href="style.css">
<title>Carlton Banks</title>
</head>
<body>
<h1>CLICK ON CARLTONS HEAD!</h1>
<a href="http://youtu.be/zS1cLOIxsQ8" target="_blank">
<img src="hey.jpg" alt="A picture" style="width:300px">
</a>
</body>
</html>
这是极其简单的css文件:
body{
h1: green
}
在浏览器上打开网站时,什么都没有显示,只是以下错误消息:
This page contains the following errors:
error on line 7 at column 10: Opening and ending tag mismatch: link line 0 and head
Below is a rendering of the page up to the first error.
当您使用XHTML时,所有标签都需要关闭。
链接标签的末尾应带有斜杠以将其关闭:
<link rel="stylesheet" type="text/css" href="style.css" />
图片标签也一样:
<img src="hey.jpg" alt="A picture" style="width:300px" />
CSS不正确。我认为这是您要尝试执行的操作:
body h1 {
color: green;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句