HTML5 锚不工作
HTML5 Anchors not working
我在 HTML5 工作,这是我的代码,我正在学习本教程-
https://www.youtube.com/watch?v=kDyJN7qQETA
代码-
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<body>
<article>Hello</article>
<meta name="description" content="Vaibhav chhabra"/>
<a name="pageTop">Top of page</a>
<a href="html5.html#pageBottom">Bottom of page</a>
<br><br><br>
<a href="youtube.com" title="Youtube Site website Titile" >Youtbe alone</a>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<p>Hello Worlddddd22222222dddddd</p>
<a href="html5.html#pageTop">Top of Page</a>
<a id="pageBottom">Bottom of page</a><br>
</body>
</head>
</html>
当我单击页面底部超链接而不是将我带到页面底部时,它会将我带到页面未找到错误,同样是页面顶部的问题。
请帮忙
您的代码应该按预期工作,但是您的标记似乎到处都是(例如,到处都是错放或丢失的标记)。
如果您希望 link 在同一页面上,请考虑仅指向锚点本身:
<a href='#pageBottom'>Bottom of Page</a>
只要您在当前位置的可访问目录中实际有一个名为该页面的页面,使用 href='#html5.html#pageBottom
方法就可以。
例子
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="description" content="Vaibhav vaihhbhav chhabra" />
<meta charset="UTF-8">
</head>
<body>
<article>Hello</article>
<a name="pageTop">Top of page</a>
<a href="#pageBottom">Bottom of page</a>
<br>
<br>
<br>
<a href="youtube.com" title="Youtube Site website Titile">Youtbe alone</a>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<p>Hello Worlddddd22222222dddddd</p>
<a href="#pageTop">Top of Page</a>
<a id="pageBottom">Bottom of page</a>
<br>
</body>
</html>
基本HTML:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body> <!--Emphasis on the opening body tag and that is outside the <head></head> section -->
<h1></h1>
<p></p>
</body>
</html>
正在创建 Anchor Tag。
The name attribute allows an anchor tag to be used to point to a specific place on a web page.
<a name="top"></a>
<a href="#top">Top</a>
您的代码中有一些错误。
我已经为你修好了。
代码-
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="description" content="Vaibhav vaihhbhav chhabra" />
<meta charset="UTF-8">
</head>
<body>
<article>Hello</article>
<a name="pageTop">Top of page</a>
<a href="#pageBottom">Bottom of page</a>
<br>
<br>
<br>
<a href="youtube.com" title="Youtube Site website Titile">Youtbe alone</a>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br><br>
<br>
<br><br>
<br>
<br><br>
<p>Hello Worlddddd22222222dddddd</p>
< a href="#pageTop">Top of Page</a>
<a id="pageBottom">Bottom of page</a>
<br>
</body>
</html>
我在 HTML5 工作,这是我的代码,我正在学习本教程- https://www.youtube.com/watch?v=kDyJN7qQETA
代码-
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<body>
<article>Hello</article>
<meta name="description" content="Vaibhav chhabra"/>
<a name="pageTop">Top of page</a>
<a href="html5.html#pageBottom">Bottom of page</a>
<br><br><br>
<a href="youtube.com" title="Youtube Site website Titile" >Youtbe alone</a>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<p>Hello Worlddddd22222222dddddd</p>
<a href="html5.html#pageTop">Top of Page</a>
<a id="pageBottom">Bottom of page</a><br>
</body>
</head>
</html>
当我单击页面底部超链接而不是将我带到页面底部时,它会将我带到页面未找到错误,同样是页面顶部的问题。 请帮忙
您的代码应该按预期工作,但是您的标记似乎到处都是(例如,到处都是错放或丢失的标记)。
如果您希望 link 在同一页面上,请考虑仅指向锚点本身:
<a href='#pageBottom'>Bottom of Page</a>
只要您在当前位置的可访问目录中实际有一个名为该页面的页面,使用 href='#html5.html#pageBottom
方法就可以。
例子
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="description" content="Vaibhav vaihhbhav chhabra" />
<meta charset="UTF-8">
</head>
<body>
<article>Hello</article>
<a name="pageTop">Top of page</a>
<a href="#pageBottom">Bottom of page</a>
<br>
<br>
<br>
<a href="youtube.com" title="Youtube Site website Titile">Youtbe alone</a>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<p>Hello Worlddddd22222222dddddd</p>
<a href="#pageTop">Top of Page</a>
<a id="pageBottom">Bottom of page</a>
<br>
</body>
</html>
基本HTML:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body> <!--Emphasis on the opening body tag and that is outside the <head></head> section -->
<h1></h1>
<p></p>
</body>
</html>
正在创建 Anchor Tag。
The name attribute allows an anchor tag to be used to point to a specific place on a web page.
<a name="top"></a>
<a href="#top">Top</a>
您的代码中有一些错误。 我已经为你修好了。 代码-
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="description" content="Vaibhav vaihhbhav chhabra" />
<meta charset="UTF-8">
</head>
<body>
<article>Hello</article>
<a name="pageTop">Top of page</a>
<a href="#pageBottom">Bottom of page</a>
<br>
<br>
<br>
<a href="youtube.com" title="Youtube Site website Titile">Youtbe alone</a>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br><br>
<br>
<br><br>
<br>
<br><br>
<p>Hello Worlddddd22222222dddddd</p>
< a href="#pageTop">Top of Page</a>
<a id="pageBottom">Bottom of page</a>
<br>
</body>
</html>