Is there a way to achieve alternating row shading within a wrapped paragraph element without using the :nth-child technique? For instance, if we have:
<p style="width:100px;">
row 0 -- hello
row 1 -- world
row 2 -- !!!
</p>
Some browsers may automatically create a soft return after "hello" and "world", resulting in all rows looking the same when rendered.
I'm looking to have rows 0 and 2 shaded differently than row 1, similar to how table rows can be styled with tr:nth-child(even) for alternating colored rows. Is there a solution for this scenario, or is there a practical alternative approach using different elements that doesn't involve breaking up the paragraph and inserting it into a table?