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

JavaScript

Mitchell North
Mitchell North
6,353 Points

How would I create multiple lines inside the <p> tag?

Say I wanted to create multiple paragraphs with line breaks inside the template literal so each line outputs as a different paragraph?

I tried something like this but it outputs all the lines continuously

<p>Hello ${person}.</p> <p>I am not ${person2).</p> <p>I am actually ${person3}</p>

I also tried <br/> but that didn't work either.

Cheers.

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Mitchell North ! That depends entirely on where you're rendering this code. If it's being rendered in the browser, then it should definitely be on separate lines. However, if you're printing it to the console, it won't be on separate lines. Instead, you'll need a "\n" at the end of the lines for it to appear separately.

Hope this helps! :sparkles: