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

why does h1 make the letters bigger but p1 doesn't define a paragraph

in order to change the paragraphs color i added p1 p2 p3 under style and made them different colors. then i changed the p before and after the paragraph to p1, p2 and p3. this worked how ever this caused the paragraphs to clump together (i already found several solutions for this and made it work) what im wondering is why h1 will still make letters bigger but p1 wont leave a line break? thanks in advance if can explain this glitch. i thought it might be a error with treehouses workspaces but i tried the same thing using notepad and it didn't work could it be a error with html if so are these errors common? should i ignore them?

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

Hey Brendan,

<p1> <p2> etc. tags don't really exist. There is only <p> tags. When you add numbers, you are creating your own custom tags and styling those need to be done differently if you want them to behave like a standard <p> tag.

Please check out this StackOverflow Thread.

:)

thanks for the quick answer Jason really appreciate it. just one thing is i still don't understand are h1 and h2 real tags also? like p, however p1 would be a custom tag like h51? thanks again

Jason Anders
Jason Anders
Treehouse Moderator 145,858 Points

h1 --> h6 only are real HTML tags and have default formatting. These are the only tags in HTML that use numbers (that I can think of off the top of my head). The purpose of the h tags are to help separate different levels of importance in a webpage. They are also use in SEO applications, but that is something you will learn further on in your lessons.

<p> tags, on the other hand, are only used to denote a paragraph (block of text) that is either on its own or under a heading. They don't need different classes or levels to distinguish them, as all paragraphs are of them same importance.

Think of a book. The Main Chapter title would be the h1 the body of text after would be the p. If you wanted a sub-section in the main chapter, you could use h2 or an h3 etc, and then more text with the p.

Overall, I recommend against 'custom tags' and can't really come up with a reason why you would need them. Classes and IDs can be used to distinguish any possible differences in stylings you would need.

I hope this helps to make more sense. :)