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 trial

HTML How to Make a Website Creating HTML Content Use the Navigation Element

Jacob Thomson
Jacob Thomson
757 Points

HTML

Looking back at my work space, I'm wondering why he used a ul and li tags to create the buttons? Why wouldn't he use button tags?

1 Answer

The button tag is reserved for forms and form like input.

We use UL, LI, and A tags for creating buttons that link around our page.

Buttons don't have a native way to direct you to another page, you would have use php or javascript or some other language in addition to your html to get a button to do what an A tag already does with the href attribute.

Jacob Thomson
Jacob Thomson
757 Points

Thanks for clarifying Mathew, I'm currently developing a website as we speak. It is a single page website, the design has buttons throughout, but i only want the button to direct you to the desired spot on the page. I'm using the <button> tag because it looks more like the design if you know what i mean? What tag would be most effective for this? I also need to add style to match the design. Matthew Greenberg

If your jumping around the page you would still want to you the A tag with an href attribute. For example

<a href="#bottom">Click me to go to the bottom of the page</a>


// place this at the bottom of the page
<div id="bottom"></div>

This will jump directly to the bottom of the page, If you want to animate a scroll, you have to use javascript. Hope this helps.

Jacob Thomson
Jacob Thomson
757 Points

I finally understand! Thank you, Matthew Greenberg