What to give as href for same page paragraph ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What to give as href for same page paragraph ?

17th Dec 2017, 10:00 AM
santhosh kumar
santhosh kumar - avatar
3 Answers
+ 6
For a link on the same page you use the id of the tag/element that you wish to link to in your <a> anchors href attribute. <p id="para">...</p> ... ... ... <a href="#para">...</a>
17th Dec 2017, 10:13 AM
ChaoticDawg
ChaoticDawg - avatar
+ 4
@Dima I don't think anybody said anything about using the whole paragraph as the link. What this does is links from somewhere else on the same page back to that paragraph. Just like you see on some pages where when you scroll down to the bottom of the page where there is a link to take you back to the top.
17th Dec 2017, 10:26 AM
ChaoticDawg
ChaoticDawg - avatar
0
What for? You can probably put text of the whole paragraph to "a" tag... but the whole paragraph as a link will look ugly dont you think? Just put it to the end of the text...
17th Dec 2017, 10:16 AM
Dima Makieiev
Dima Makieiev - avatar