Reputation:
I am working in HTML5 and this is my code and i am following this tutorial- https://www.youtube.com/watch?v=kDyJN7qQETA
The code -
<!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>
When i click on Page Bottom Hyperlink instead of taking me to the bottom of the page , it takes me to Page not found error ,same is the problem with Page Top. Plz help
Upvotes: 0
Views: 1029
Reputation: 139
There is some error in your code. I have fixed it for you. CODE-
<!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>
Upvotes: -1
Reputation: 5943
Basic 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>
Creating an 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>
Upvotes: 0
Reputation: 76547
Your code should be working as expected, however your markup appears to be all over the place (e.g. misplaced or missing tags scattered throughout).
If you expect your link to be on the same page, consider just pointing to the anchor itself :
<a href='#pageBottom'>Bottom of Page</a>
Using the href='#html5.html#pageBottom
approach will work as long as you actually have a page called that within an accessible directory from your current location.
Example
<!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>
Upvotes: 3