Here is the HTML code snippet I am working with:
<p class="main-text">
<span>Lorem Ipsum</span>
<span>Lorem Ipsum</span>
<span>Lorem Ipsum</span>
<span>Lorem Ipsum</span>
<span>Lorem Ipsum.</span>
</p>
Accompanied by the following CSS style:
.main-text > span {
display: inline-block;
}
I am looking for a way to have a single anchor tag wrap around all spans, allowing the user to click the link when hovering over any of the text content. Is there a solution to achieve this without individually wrapping each span element in an anchor tag?
<p class="main-text">
<a href="same url">
<span>Lorem Ipsum</span>
</a>
<a href="same url">
<span>Lorem Ipsum</span>
</a>
<a href="same url">
<span>Lorem Ipsum</span>
</a>
<a href="same url">
<span>Lorem Ipsum</span>
</a>
<a href="same url">
<span>Lorem Ipsum.</span>
</a>
</p>
Your assistance is greatly appreciated.