HI all, I was wondering if it is legal to have a span tag inside a legend, something like this <legend>This is my<span>legend</span></legend>
Can't quite work out whether legend is a block element or inline

Recommended Answers

For completeness, the HTML5 docs allow "Phrasing content" as children of <legend>. The span tag is

Jump to Post

All 4 Replies

With regard to being "legal" I assume that you mean conforming to the W3C standards? Having a span element within the legend element should not cause the document to not pass validation.

I assume the reason why you want to use the span tag is for applying certain styles that you just cant do alone with the legend element.

inline/block? I'm pretty sure its an inline element.

cool, thanks for that. Yes it is to apply some style

fab thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.