What Is The Difference Between H1 And H2
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.
what is the difference between h1,h2,h3?
I dont understand when to make a tag with h1 or h2 or h3
5 Answers
Same as in Word document you can use different types of headings - h1 is going to be your main/top-level heading and h2 and h3 are going to be sub-headings, you can style them differently so they will have different font size or colour.
Johnny Garces
It's important to think about heading tags as elements that give meaning to your HTML content. It has nothing to do with size and style. Heading tags are used to convey information and to allow for screen-readers to read that information in a way that makes sense for people who are visually impaired.
Please disregard the idea that headings have anything to do with styling.
Think about a newspaper: You'll start with the main section of the newspaper
< main > < h1 >World News</ h1 > < section > < h2 >News on Europe </ h2 > < article > < h3 >France will host the next Olympic games</ h3 > < p >lorem ipsum **insert news content here**</ p > </ article > < article > < h3 >The UK has no idea what's going on right now with Brexit</ h3 > < p >lorem ipsum **insert news content here**</ p > </ article > </ section > < section > < h2 >News on Asia</ h2 > < article > < h3 >Vietnam is the hottest place to travel</ h3 > < p >lorem ipsum **insert news content here**</ p > </ article > < article > < h3 >Tokyo records the coolest day in years</ h3 > < p >lorem ipsum **insert news content here**</ p > </ article > </ section > </ main >
Notice that the headings are organized with h1 being the main heading (i.e. World News), followed IMMEDIATELY with its child, the h2 (i.e. News on Europe), and then for each subsequent news article, the heading will be a h3.
We can conclude, therefore that headings must be organized in a parent-child relationship so that Screen-Readers can better organize the content and communicate it to those who are visually impaired. This also helps a ton with SEO/search-engines.
Again- your reasons for using h1,h2,h3,h4 should have nothing to do with sizing/font-styles. That's what CSS is for.
Here's a good resource on headings via MDN https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements
h1, 2, and 3 also have different sizes. h1 will be the biggest, 3 the smallest.
givens
This W3 schools link provides an example of h1 to h6 tags. Note, in this example, they get smaller as you go from h1 to h6. This is typical. However, the styling depends on CSS. While unusual, it is possible to have h1 smaller than or the same size as the h2 header. However, it's importance is always as the main heading and not a subheading like h2.
Johnny Garces
sorry, Cory- although you're technically right, I find myself misusing headings on the basis of their style and size. This is a no-no for web-accessibility.
What Is The Difference Between H1 And H2
Source: https://teamtreehouse.com/community/what-is-the-difference-between-h1h2h3
Posted by: renzibaxt1936.blogspot.com
0 Response to "What Is The Difference Between H1 And H2"
Post a Comment