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 trialAdam Maley
5,946 PointsWhy is it necessary to add <p> html tags within quotations for dialogue boxes?
Why is it necessary to add <p> html tags within quotations for dialogue boxes?
Then sometimes I see him not using the "<p>Hello, press the" + " enter button.</p>" tags.
Couldn't I just type "Hello, press the enter button." ?
4 Answers
Steven Parker
231,275 PointsIt depends on how the string is to be used.
If it is being written directly to the document, the tags cause an element to be created (in this case, a paragraph).
But in other cases the string might be used to update an existing element's text content, and in that case tags would not be used.
Andrew Dovganyuk
10,633 PointsYeah it is for personal purposes :)
Abdulrahman Teima
1,091 Pointsthe <p> is added to make it a paragraph
Matthew Williams
Full Stack JavaScript Techdegree Student 1,188 PointsI must admit I was slightly confused at first with this. Makes sense now.
Ezell Frazier
22,110 PointsEzell Frazier
22,110 PointsThe <p></p> tags are not necessary.
The tags exist for formatting purposes. When the results display on the HTML document, elements within the tags will have better line spacing.
However, I would recommend using the tags as a good practice.