I am making a codepen to take notes/make sure I comprehend what I’m learning as I go through the JS curriculum, and I have a question about the HTML formatting. I am using the
tag when writing out the example code. Sometimes I see people say to never use
and if that’s true, what’s the best way to do that instead? If I make a new paragraph, it will add an extra space between lines that I don’t necessarily want–I just want it to be on the line directly below it. Should I make a class for all my examples and format it in CSS? I’m currently using to add the white background behind examples and key words, and I’m not even sure if that’s the correct way to handle it? Thank you for any input, about my specific situation as well as the bigger question of: is there any good reason to use
in the “real world”?
Here is an example of the HTML, and the link to my codepen:
<p><span>function pizzaTotal(order1, order2) {<br>
console.log(order1 + order2);<br>
}<br>
pizzaTotal(4, 3);
</span></p>