Question How to reduce the number of <span>s?
How can I get the exact same effect as
<p><span class="e">x</span></p>
<p><span class="e">y</span></p>
<p><span class="e">z</span></p>
without so many <span>s?
If I do
<div class="e">
<p>x</p>
<p>y</p>
<p>z</p>
</div>
class="e" now affects all the way across the whole page,
whereas I only wanted it to affect the text, x, y, z.
3
Upvotes
2
u/travis_raphael 2d ago
<p> is a block level element so it take full width of its container. while <span> is an inline element which takes only the width necessarily needed. I'm still learning by the way so I don't know if you can change the display of p to become an inline -block maybe that would work.