它在谷歌浏览器中看起来像这样:
<html>
<head>
<title>Hello World!</title>
</head>
<body>
<h1 align="center">Hello World!<br/>Welcome to My Web Server.</h1>
</body>
</html>
为什么没有按预期转变?
编辑:是的,该文件确实有一个 .html 文件名。根据我正在使用的教程,我不确定它是否需要一个标题,它说它应该在没有标题的情况下正确渲染?这一切都是新的,所以我不确定。
编辑:当我用 textedit 打开它时,我得到了这个:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1038.35">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
</style>
</head>
<body>
<p class="p1"><html></p>
<p class="p1"><head></p>
<p class="p1"><title>Hello World!</title></p>
<p class="p1"></head></p>
<p class="p1"><body></p>
<p class="p1"><h1 align="center">Hello World!<br/>Welcome to My Web Server.</h1></p>
<p class="p1"></body></p>
<p class="p1"></html></p>
</body>
</html>
我根本不记得像这样保存它。