Html 如何在html中创建新页面?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11279581/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to make new page in html?
提问by Madison Young
I am a noob at HTML. I have a folder on my desktop with page1.html and page2.html. This is an example of page1
我是 HTML 的菜鸟。我的桌面上有一个包含 page1.html 和 page2.html 的文件夹。这是第 1 页的示例
<html>
<h1> Welcome
<title>Website
</h1>
<body>
<p> to page 2
</body>
<a href="page2.html" target="_self">Link</a>
</html>
Whenever I open page1.html, It just says "Welcome", and "to page 2". There is no hyperlink. What am I doing wrong?
每当我打开 page1.html 时,它只是说“欢迎”和“到第 2 页”。没有超链接。我究竟做错了什么?
采纳答案by Steven Luu
You are missing a </p>
tag and the <a>
tag should be inside the <body>
tag.
您缺少一个</p>
标签,该<a>
标签应该在<body>
标签内。
<h1>
tag is malformed as well. Remember, this is just like parentheses in math. If you open one then you need to close one.
<h1>
标签也是畸形的。请记住,这就像数学中的括号一样。如果你打开一个,那么你需要关闭一个。
<html>
<head>
<title>Website</title>
</head>
<body>
<h1>Welcome</h1>
<p>
<a href="page2.html" target="_self">Link to page 2</a>
</p>
</body>
</html>
回答by Naddiseo
The A tag should be inside the body tags. You probably also want to close the p tag.
A 标签应该在 body 标签内。您可能还想关闭 p 标签。
Try something like:
尝试类似:
<html>
<head><title>Website</title></head>
<body>
<h1>Welcome</h1>
<p>to page 2 <a href="page2.html">Link</a></p>
</body>
</html>
回答by Stephen
Try this. (remember to close your tags!)
尝试这个。(记得关闭你的标签!)
<html>
<h1> Welcome
<title>Website </title>
</h1>
<body>
<p> to page 2 </p>
<a href="page2.html" target="_self">Link</a>
</body>
</html>
回答by bfavaretto
You should close <title>
with </title>
. Fixing that will make the rest of the content show (demo).
你应该<title>
用</title>
. 修复这将使其余内容显示(演示)。
As others are saying, you should also close your <p>
tags, and move the <a>
inside the <body>
. Also, <title>Welcome</title>
should be outside <h1>
, and <h1>
should be inside <body>
.
正如其他人都这么说,你也应该关闭<p>
的标签,然后移动<a>
内部<body>
。另外,<title>Welcome</title>
应该在外面<h1>
,<h1>
应该在里面<body>
。
It simpler to see with an example. The valid HTML would be:
举个例子就更简单了。有效的 HTML 将是:
<html>
<head>
<title>Website</title>
</head>
<body>
<h1>Welcome</h1>
<p>to page 2</p>
<a href="page2.html" target="_self">Link</a>
</body>
</html>
回答by Al Koury
Your <title>
tag should go in your document's head and your content should all be inside the body. You also need to close all your tags.
你的<title>
标签应该在你的文档的头部,你的内容应该都在正文中。您还需要关闭所有标签。
Try this:
尝试这个:
<html>
<head>
<title>Website</title>
</head>
<body>
<h1>Welcome</h1>
<p> To page 2: <a href="page2.html" target="_self">Link</a></p>
</body>
</html>
回答by Shubham Badal
The title and everything the browser needs to understand the page is better suited to go in between the <head> </head>
tags.
标题和浏览器理解页面所需的一切更适合放在<head> </head>
标签之间。
The content that has to be displayed in the browser viewport windows has to be in between the <body> </body>
tags. As others have mentioned, most of the HTML tags require to be closed.
必须在浏览器视口窗口中显示的内容必须在<body> </body>
标记之间。正如其他人所提到的,大多数 HTML 标签都需要关闭。
Also, the <!DOCTYPE>
declaration must be the very first thing in your HTML document before the <html>
tag.
此外,<!DOCTYPE>
声明必须是 HTML 文档中<html>
标签之前的第一件事。
<!DOCTYPE html>
<html>
<head>
<title>Website</title>
</head>
<body>
<h1> Welcome </h1>
<p> to page 2 </p>
<a href="page2.html" target="_self">Link</a>
</body>
</html>
For a quick tutorial or help you can always refer the following website seen below. It's easy and fun. Best of luck!
如需快速教程或帮助,您可以随时参考以下网站。这很容易也很有趣。祝你好运!