Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you have a <span> within a <span>?

Tags:

html

css

People also ask

Can you put a span inside an a tag?

SPAN is a GENERIC inline container. It does not matter whether an a is inside span or span is inside a as both are inline elements.

What is a nested span?

Nesting span tags is valid HTML. A span tag is non-semantic markup intended for grouping inline content, and is a valid wrapper for phrasing content. This includes tags like strong , em , time , and etc, but also additional span tags.

Can we use span inside I?

Yes, it is valid to have a <span> tag as the content of an <i> tag.

What elements can be inside span?

The span element is an inline element, which should contain only other inline elements and no block elements. From the spec: Generally, block-level elements may contain inline elements and other block-level elements. Generally, inline elements may contain only data and other inline elements.


HTML4 specification states that:

Inline elements may contain only data and other inline elements

Span is an inline element, therefore having span inside span is valid. There's a related question: Can <span> tags have any type of tags inside them? which makes it completely clear.

HTML5 specification (including the most current draft of HTML 5.3 dated November 16, 2017) changes terminology, but it's still perfectly valid to place span inside another span.


Yes. You can have a span within a span. Your problem stems from something else.