What elements can a span tag contain in HTML5?

So, I was a CLI or Cron developer in PHP for most of my career, and now I will find out why I don't like working with the user interface in school;) I am dealing with HTML5 validation here, and I can not find the answer to the question, which refers to curosity. I checked the W3C HTML5 check on my homepage and I got some errors around divs within the limits <span>and this is not allowed. I tried changing everything <div>within the spaces to <p>, but getting almost the same error. http://www.w3schools.com/html5/tag_span.asp does not explicitly indicate which elements are valid within <span>, and also an error from validation:

Line 85, Column 69: The p element is not allowed as a child span of this context. (Suppression of further errors from this subtree.)

2 questions:

1) What elements, if any, are permissible within <span>?

2) Where can I indicate which elements are allowed in another? I googled but can't see anything that has a W3C stamp.

+28
source share
1 answer

Inside inline elements can only contain inline elements. spanis an inline element. Thus, tags such as a, img, supetc., may move within a range, but the block-level elements, such as divand pmay not.

UPDATE

, , -. "" (, a), - (, span).

, HTML-, WHATWG HTML-. HTML , (. " " ):

http://www.whatwg.org/specs/web-apps/current-work/multipage/#auto-toc-4

span, , "" .

http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-span-element

+44

Source: https://habr.com/ru/post/1679260/


All Articles