0

Why isn't it linking?

hi so ive been trying to link my table of contents to a paragraph/subheading please help. <a herf="home">home</a><br /> <a herf="about-us">about-us</a> <h1>home</h1> <p>1st paragraph filled with lots of words here</p> <h1>about-us</h1> <p>2nd paragraph filled with lots of words here</p>

15th Feb 2017, 4:41 PM
Codie Richards
Codie Richards - avatar
3 Answers
+ 4
simple typo. <a href= 
>
15th Feb 2017, 4:43 PM
Huegel
Huegel - avatar
+ 4
Actually your code try to load new pages named "home" and "about-us"... If your purpose is to scroll the viewport to a particular element, you need to give it an unique id as reference, and prefix this id by '#' in the href attribute: <a href="#home">Home</a> <a href="#about">About us</a> <h1 id="home">Home</h1> <p>Lot of words...</p> <h2>About us</h2> <p id="about">Also lot of words...</p> I intentionally don't place the id on same element in both case: try it to see the difference when you click on links... first( home ) will align the <h1> block with top of window, second will do the stuff with the <p> block. Depends on needs, you choose the behaviour you want ;)
15th Feb 2017, 5:51 PM
visph
visph - avatar
+ 1
thanks man i was going crazy wondering WTH i did wrong
15th Feb 2017, 4:55 PM
Codie Richards
Codie Richards - avatar