L'element HTML <div> (o Element de divisió de document HTML) és un contàiner genèric per contingut dinàmic, el qual no representa res inherentment. Es pot utilitzar per agrupar elements per a fins d'estil (utilitzant els atributs class o id), o perquè comparteixen valors d'atribut, com ara lang. Només s'hauria de fer servir quan cap altre element semàntic (com ara <article> o <nav>) sigui apropiat.
| Categories de contingut | Contingut dinàmic, contingut palpable. |
|---|---|
| Contingut permès | Contingut dinàmic. |
| Omissió de l'etiqueta | Cap, tant l'etiqueta inicial com l’etiqueta final són obligatòries |
| Elements pares permessos | Qualsevol element que accepti contingut dinàmic. |
| Interfície DOM | HTMLDivElement |
Atributs
Aquest element inclou els atributs globals.
L'atribut align és obsolet; no el feu servir més.
Exemples
<div> <p>Aquí qualsevol tipus de contingut. Com ara <p>, <table>. El que sigui!</p> </div>
Resultat
Aquí qualsevol tipus de contingut. Com ara <p>, <table>. El que sigui!
Especificacions
| Especificació | Estat | Comentaris |
|---|---|---|
| HTML Living Standard The definition of '<div>' in that specification. |
Living Standard | Cap canvi des de la última instantània |
| HTML5 The definition of '<div>' in that specification. |
Recommendation | align és obsolet |
| HTML 4.01 Specification The definition of '<div>' in that specification. |
Recommendation |
Compatibilitat amb navegadors
We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!
| Característica | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
|---|---|---|---|---|---|
| Suport bàsic | 1.0 | (Yes) | (Yes) | (Yes) | (Yes) |
| Característica | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|
| Suport bàsic | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
Vegeu també
- Elements de seccionament semàntics:
<section>,<article>,<nav>,<header>,<footer> <span>element per a l'estil de contingut estàtic.