Why isn't the <nav> section of this code working?I mean if i click on about me why isn't it taking me to the about me section? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why isn't the <nav> section of this code working?I mean if i click on about me why isn't it taking me to the about me section?

https://code.sololearn.com/WhAJt0hPbsYt/?ref=app

7th Sep 2017, 3:52 AM
sheikhrafe
16 Answers
+ 1
here is your working code i made some correction in it https://code.sololearn.com/Wcxi29u0WnJq/?ref=app
7th Sep 2017, 5:23 AM
$ Suresh Purohit $
$ Suresh Purohit $ - avatar
+ 3
You have several errors and issues in your html code in addition to what @Calvin said. Your nav tag isn't closed as well as your action tag. You're using a tags incorrectly and treating them both as a self closing tag in addition to the closing tag. <a .... />...</a> is wrong should be like <a ... >...</a>. Your table header row should look more like: <tr><th></th><th>Course</th><th>Status</th><th>Result</th><th>Year</th></tr> use of classes is incorrect: <section class="about me"><h2>About Me</h2> about and me are two separate classes when written like this (space seperated). What you really want is an id anyhow: <section id="about-me"><h2>About Me</h2> Then in your anchor (<a></a>) tags href use href="#about-me" instead.
7th Sep 2017, 4:19 AM
ChaoticDawg
ChaoticDawg - avatar
+ 3
now I fully understand.....thanks guys
7th Sep 2017, 5:44 AM
sheikhrafe
+ 2
You cant use Css class for href redirect. Use Css id instead.
7th Sep 2017, 4:01 AM
Calviղ
Calviղ - avatar
+ 2
Just change it to href="#about-me" and About Us div set to id="about-me" Btw, ".about me" or "#about me" is wrong way to refer to class or id name, ".about-me" or "#about-me" is correct. You can use lots of id selectors in one html document, make sure the the id names are unique.
7th Sep 2017, 4:15 AM
Calviղ
Calviղ - avatar
+ 2
Except @Suresh's code still has most of the other errors included in it. A tags are wrong, table header is wrong, and the action tag isn't closed.
7th Sep 2017, 5:37 AM
ChaoticDawg
ChaoticDawg - avatar
+ 2
You should not use the exact same id more than once in a page. You can have 1 different id per tag just fine.
7th Sep 2017, 5:42 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
thanks guys
7th Sep 2017, 5:16 AM
sheikhrafe
+ 1
Why do you reluctant to use id? Do you know you can have multiple classes and an id selector in one tag?
7th Sep 2017, 5:38 AM
Calviղ
Calviղ - avatar
+ 1
yes , and all the best for ur page
7th Sep 2017, 5:38 AM
$ Suresh Purohit $
$ Suresh Purohit $ - avatar
+ 1
You only cannot use the same id name in one document. You can use as many ids as you want provided the name of the id are different.
7th Sep 2017, 5:43 AM
Calviղ
Calviղ - avatar
0
got it....but in the course they said id cannot be used more than once in a page...
7th Sep 2017, 4:08 AM
sheikhrafe
0
The course is right. Id can use only once.
7th Sep 2017, 4:10 AM
Calviղ
Calviղ - avatar
0
then what should i do to solve the problem?
7th Sep 2017, 4:11 AM
sheikhrafe
0
awesome suresh....now I dont have to use id and I can also style the page by adding class in it....
7th Sep 2017, 5:29 AM
sheikhrafe
0
@Calvin because the course said one should not use id more than once in a page
7th Sep 2017, 5:41 AM
sheikhrafe