Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTomasz Sporys
11,258 Pointswhich way is right implementing <a> elements?
I have two options building clickable elements. No matter if its Navigation elements or any other. I don't know what is right? Let's for instance use ul: Should a element be nested inside li or the other way round? Could you please tell me how I should use it?
3 Answers
Daniel Kurowski
11,231 PointsHey, Tomasz "li" it's an element which is part of a list, so link should be nested inside it. Think about it like that:
- "ul" is a table
- "li" is a chair
- and "a" is a guest sitting on this chair. Without chair couldn't sit :)
So: ul
li > a
That's the way I do it.
Hope could help.
Rasbin Rijal
Courses Plus Student 10,864 PointsHi Tomasz,
The <a> tag defines a hyperlink, which is used to link from one page to another.
The most important attribute of the <a> element is the href attribute, which indicates the link's destination.
By default, links will appear as follows in all browsers:
An unvisited link is underlined and blue A visited link is underlined and purple An active link is underlined and red
Code syntax :
<a href="http://www.teamtreehouse.com">Visit treehouse website! </a>
Jereld Koh
2,251 PointsHi, I'm new to HTML so it would be great if you could clarify some of my doubts! :)
Is it true that all hyperlinks are included with an <a>? Is it true that all hyperlink references has to come first before the clickable elements?
your help would be much appreciated!
Daniel Kurowski
11,231 PointsThanks Harry :) sometimes it's helpful to visualise things
Harry James
14,780 PointsHarry James
14,780 Points+1 for this analogy :) Great way of thinking about it!