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 trialJodi Barry
1,846 PointsWhy would you use <p> vs. <h1> in a document.write string? I don't understand what you put in there and why?
Example: How do you determine which one to use? document.write("<p>My first JavaScript 'program'</p>"); OR document.write("<h1>My first JavaScript 'program'</h1>"); OR other choices (if there are any)?
2 Answers
Clayton Perszyk
Treehouse Moderator 48,850 Points<p> and <h1> are HTML tags and have different meanings:
<p> is a paragraph tag
<h1> is a level one heading (i.e. top level heading)
I would recommend going through a course on HTML, if this is causing confusion:
Em Har
9,775 PointsThe H1 tag will enlarge you the content in between the tags as its meant to be a "heading" to grab the viewers attention. The <p> tag will not enlarge the text and will keep it as a regular sentence.
Jodi Barry
1,846 PointsJodi Barry
1,846 PointsHTML tags as far as position? Yes, I think the HTML course would help as I have not done that yet. Thanks!