Block Elements in Inline Elements | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Block Elements in Inline Elements

There is no html validation error when I place a block element inside an inline element. Why is that?

16th Nov 2019, 11:00 AM
yushan fernando
yushan fernando - avatar
5 Answers
+ 3
yushan fernando Validator is working fine. There is no warning because html5 standards allow both inline and block level tags to be nested within an anchor tag. https://www.bennadel.com/blog/3693-anchor-tags-can-contain-block-level-elements-as-of-html5.htm
16th Nov 2019, 12:20 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 2
Sololearn will not give errors or warning messages. Even our browsers don't ^.^ How can we expect a <10mb app to do all this? You can use https://validator.w3.org/ for validating your codes.
16th Nov 2019, 11:44 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 2
yushan fernando , It works. I think you just don't know how to use it. Try this input <span><div>lorem </div></span> Output : ""' Error: Element div not allowed as child of element span in this context. (Suppressing further errors from this subtree.) From line 1, column 7; to line 1, column 11 <span><div>lorem Contexts in which element div may be used: Where flow content is expected. As a child of a dl element. Content model for element span: Phrasing content. """
16th Nov 2019, 12:08 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
0
Yes I also use https://validator.w3.org/ for html validations. This tool not show any errors. That's why I'm asking above question
16th Nov 2019, 11:57 AM
yushan fernando
yushan fernando - avatar
0
Try this input <a href="#" ><div>lorem</div></a> 🇮🇳Omkar🕉 //Busy , Exams.
16th Nov 2019, 12:10 PM
yushan fernando
yushan fernando - avatar