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

JavaScript JavaScript Basics (Retired) Storing and Tracking Information with Variables The Variable Challenge Solution

Ali Sh
Ali Sh
2,026 Points

what does <h2> and </h2> stand for?

when should i use them and what is the difference between them

1 Answer

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi there! The <h2> and </h2> are HTML elements representing "headlines". The 2 indicates the importance. These go in order from 1 down to 6. The <h1> is the most important and the <h6> is the least important.

The <h2> is the beginning tag and the </h2> is the closing tag. Any text that appears between them will be classified as a headline and styled with any stylings given to h2 elements (either by custom CSS or the user agent sheet).

Here's an example of the HTML for an h2 element:

<h2>I'm a level 2 headline!</h2>

Might I make a suggestion and advise that you learn some basic HTML and CSS before you continue with JavaScript? The three front-end languages are HTML, CSS and JavaScript. While JavaScript is also a backend language it is still used a lot to manipulate HTML and CSS. This will be infinitely easier if you understand the basics of HTML and CSS before starting to learn how to change them.

Hope this helps! :sparkles: