Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
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: