Home >Web Front-end >HTML Tutorial >Why is it said that inline elements can only accommodate text or other inline elements? _html/css_WEB-ITnose
css inline
Can inline elements only hold text or other inline elements? "Inline elements can only hold text or other inline elements". This is usually true, but there are some exceptions.
For example, after the advent of HTML5, the inline element a can contain block elements.
Most inline elements cannot contain block elements.
For example, if you replace the a tag containing a div with span,
an error will be reported during W3C verification. Although the verification reports an error, the browser can still display it.
It’s just that there is no standard definition of this display rule.
One principle of HTML design is to try to make the page elements displayable, as long as it is not a very bad error.
Some rules are not mandatory, just like morals.
You can put block elements inside inline elements, but you shouldn't.