martes, 20 de noviembre de 2012

The display of elements


The display of elements

1. In HTML 4

The HTML 4 "ordered" items based on the type of display in browsers (http://www.w3.org/TR/html4/struct/global.html # h-7.5.3). The block type element are displayed below each other. This is the case of paragraphs <p>, <hx> titles, <div> boxes ...

The inline type element shown alongside each other in the text line. This is the case of ties <a> <span> divisions, styles <strong>, <em> ...

We also have display: inline-block, list-item, table, table-row ...

Overlapping rules state that:

single inline element may contain other data and inline element, ie text.
block element can contain other block element and inline elements.
However, with display can switch seamlessly display type. So with display: block, you can display a link <a> like a block and thus present all the characteristics of the blocks.

2. in HTML5

In HTML5 this "classification" is obsolete. Moreover, no longer considered as a type of classification. This means that you, the author of the website, which should indicate how the different elements to be displayed. Otherwise, apply the default style sheet for each browser.

You can insert an element smoothly <a> <h2> containing a title, a picture and a paragraph <p> <img>, provided they specify the display mode in each style sheets with display property.

This structure would be correct in HTML5:

<a>
   <h2> My title </ h2>
   <img src = "..." alt = "..." />
   <p> blah blah ... </ p>
</ a> cough.

No hay comentarios:

Publicar un comentario