TOP CATEGORIES

×

Can span be nested?

M

Mohit Verma

Nested <span> in HTML

Yes, the <span> element can be nested within other HTML elements including other <span> tags. Actually, the nesting <span> tags allow to apply different styles or attributes to specific parts of the content within an element.

Syntax Example

<p>This is a <span style="font-weight: bold;"><span style="color: red;">nested</span> Highlited Word</span> in a paragraph.</p>

More Examples for a better understanding of nested <span> tag

<style>

  .span-bold {

    font-weight: bold;

    color: red;

    background: blue;

  }

</style>

<p>This is a <span class="span-bold">nested</span> highlited word in a paragraph.</p>

1 votes

Your Answer

Email: advertise@gdatamart.com

Donate: To Support US

© 2024 GDATAMART.COM (All Rights Reserved)