A span
is an inline
element and div
is a block
element. Is there a 'native' (X)HTML / HTML5 inline-block
element that can act like a container? (Without applying CSS)
Definitions:
block
This value causes an element to generate a block box.
inline-block
This value causes an element to generate an inline-level block container. The inside of an inline-block is formatted as a block box, and the element itself is formatted as an atomic inline-level box.
inline
This value causes an element to generate one or more inline boxes.
You can set a block-level element to display like an inline element by setting the display property to inline. You can also cause inline elements to behave like block-level elements using the display property.
YES there is an element that defaults to inline. The answer is the span element.
div is a “block element” (now redefined as Flow Content) and span is an “inline element” (Phrasing Content).
No, there is not. You have to specify inline-block
explictly.
Strictly speaking <button>
fulfils the criteria set. HTML5 says
When the button binding applies to a button element [which it ordinarily does], the element is expected to render as an 'inline-block' box rendered as a button whose contents are the contents of the element.
However while it is a container element that has a default inline-block rendering, it is not a General Purpose container so can't be used for anything but as a button.
iframe
is also inline-block too
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With