¿Hay algún elemento html sin ningún estilo?

<div>s have a block display model.

<span>s have an inline display model.

Is there any element without any presentation purpose, whose unique goal would be to group other elements ?

preguntado el 22 de mayo de 12 a las 15:05

Por qué no usar divs o spans and then alter the display via CSS? -

div y span are the logical containers. You could see the basic css settings for webkit aquí. -

5 Respuestas

No. Every element must have a value for the display property. CSS doesn't allow for the possibility of a null value.

<div> y <span> are the generic grouping elements, and there are numerous non-generic grouping elements. You just have to select the right one for the context (which depends on the markup and semantics involved, not the default value of display).

contestado el 22 de mayo de 12 a las 15:05

Correct, even unknown HTML tags have a display property: jsfiddle.net/yDDjH - ilanco

While eight years later it is still valid that an elements display property value can not be null, the new display: contents; addresses this - see my answer below: stackoverflow.com/a/64952600/1510754 - conceptodeluxe

Well - at least with CSS3 you can control it better, e.g. in your div


This can be used to the same effect as a reset style sheet.

Respondido 19 Feb 14, 10:02

Yep. I don't remember exactly why I was asking this, but I think it was related to a need to group <li> elements (kinda like tbody) for table rows. - maël nison

One of the most useful CSS answers on the web!!! - U Rogel

div y span has no semantic meaning; they are made exactly for the purpose of grouping elements.

contestado el 22 de mayo de 12 a las 15:05

No, there are no elements used for grouping any kind of visual elements.

Puede utilizar el <thead>, <tfoot> y <tbody> elements to group <tr> elements in a table.

contestado el 22 de mayo de 12 a las 16:05

Aunque la <div> y <span> elements as well as newer semantic elements such as <article>, <aside>, <footer>, <header>, <main>, <nav>, <section> etc. fulfill the purpose of grouping, they all come with default user agent styles.

Though it is possible to override these styles as needed, the nesting of elements within the DOM tree itself may have undesired effects. For instance, when using display: flex; on a parent element, the rendering of its immediate child elements (>) is influenced by this.

The new CSS display: contents; property value is intended to solve this issue:

display: contents causes an element's children to appear as if they were direct children of the element's parent, ignoring the element itself. This can be useful when a wrapper element should be ignored when using CSS grid or similar layout techniques.

Yet, the browser support is not as good as one would hope by the end of 2020:


Further details on how the implementation debemos work in detail can be found in the spec:


respondido 22 nov., 20:09

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.