Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 949877 of <div>

  • Revision slug: Web/HTML/Element/div
  • Revision title: <div>
  • Revision id: 949877
  • Created:
  • Creator: llue
  • Is current revision?
  • Comment

Revision Content

{{HTMLRef}}

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 {{HTMLElement("article")}} o {{HTMLElement("nav")}}) sigui apropiat.

Categories de contingut Contingut dinàmic, contingut palpable.
Contingut permès Contingut dinàmic.
Omissió de l'etiqueta {{no_tag_omission}}
Elements pares permessos Qualsevol element que accepti contingut dinàmic.
Interfície DOM {{domxref("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 &lt;p&gt;, &lt;table&gt;. El que sigui!</p>
</div> 

Resultat

Aquí qualsevol tipus de contingut. Com ara <p>, <table>. El que sigui!

Especificacions

Especificació Estat Comentaris
{{SpecName('HTML WHATWG', 'grouping-content.html#the-div-element', '<div>')}} {{Spec2('HTML WHATWG')}} Cap canvi des de la última instantània
{{SpecName('HTML5 W3C', 'grouping-content.html#the-div-element', '<div>')}} {{Spec2('HTML5 W3C')}} align és obsolet
{{SpecName('HTML4.01', 'struct/global.html#h-7.5.4', '<div>')}} {{Spec2('HTML4.01')}}  

Compatibilitat amb navegadors

{{CompatibilityTable}}

Característica Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Suport bàsic 1.0 {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
Característica Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Suport bàsic {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}

Vegeu també

  • Elements de seccionament semàntics:  {{HTMLElement("section")}}, {{HTMLElement("article")}}, {{HTMLElement("nav")}}, {{HTMLElement("header")}}, {{HTMLElement("footer")}}
  • {{HTMLElement("span")}} element per a l'estil de contingut estàtic.
 

Revision Source

<p>{{HTMLRef}}</p>

<p>L'<strong>element</strong> <strong>HTML <code>&lt;div&gt;</code> </strong>(o<em> Element de divisió de document HTML</em>) é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 <strong>class</strong> o <strong>id),</strong> o perquè comparteixen valors d'atribut, com ara <strong>lang</strong>. Només s'hauria de fer servir quan cap altre element semàntic (com ara {{HTMLElement("article")}} o {{HTMLElement("nav")}}) sigui apropiat.</p>

<table class="properties">
 <tbody>
  <tr>
   <th scope="row"><a href="/en-US/docs/Web/HTML/Content_categories" title="HTML/Content_categories">Categories de contingut</a></th>
   <td><a href="/en-US/docs/Web/HTML/Content_categories#Flow_content">Contingut dinàmic</a>, contingut palpable.</td>
  </tr>
  <tr>
   <th scope="row">Contingut permès</th>
   <td><a href="/en-US/docs/Web/HTML/Content_categories#Flow_content">Contingut dinàmic</a>.</td>
  </tr>
  <tr>
   <th scope="row">Omissió de l'etiqueta</th>
   <td>{{no_tag_omission}}</td>
  </tr>
  <tr>
   <th scope="row">Elements pares permessos</th>
   <td>Qualsevol element que accepti <a href="/en-US/docs/Web/HTML/Content_categories#Flow_content">contingut dinàmic</a>.</td>
  </tr>
  <tr>
   <th scope="row">Interfície DOM</th>
   <td>{{domxref("HTMLDivElement")}}</td>
  </tr>
 </tbody>
</table>

<h2 id="Attributes" name="Attributes">Atributs</h2>

<p>Aquest element inclou els <a href="/en-US/docs/Web/HTML/Global_attributes">atributs globals</a>.</p>

<p>L'atribut <strong>align</strong> és obsolet; no el feu servir més.</p>

<h2 id="Examples" name="Examples">Exemples</h2>

<pre class="brush: html">
&lt;div&gt;
  &lt;p&gt;Aquí qualsevol tipus de contingut. Com ara &amp;lt;p&amp;gt;, &amp;lt;table&amp;gt;. El que sigui!&lt;/p&gt;
&lt;/div&gt; 
</pre>

<h3 id="Result" name="Result">Resultat</h3>

<p>Aquí qualsevol tipus de contingut. Com ara &lt;p&gt;, &lt;table&gt;. El que sigui!</p>

<h2 id="Specifications" name="Specifications">Especificacions</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Especificació</th>
   <th scope="col">Estat</th>
   <th scope="col">Comentaris</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('HTML WHATWG', 'grouping-content.html#the-div-element', '&lt;div&gt;')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>Cap canvi des de la última instantània</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5 W3C', 'grouping-content.html#the-div-element', '&lt;div&gt;')}}</td>
   <td>{{Spec2('HTML5 W3C')}}</td>
   <td><strong>align </strong>és obsolet</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML4.01', 'struct/global.html#h-7.5.4', '&lt;div&gt;')}}</td>
   <td>{{Spec2('HTML4.01')}}</td>
   <td>&nbsp;</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility" name="Browser_compatibility">Compatibilitat amb navegadors</h2>

<p>{{CompatibilityTable}}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Característica</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari (WebKit)</th>
  </tr>
  <tr>
   <td>Suport bàsic</td>
   <td>1.0</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Característica</th>
   <th>Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Phone</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Suport bàsic</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<h2 id="See_also" name="See_also">Vegeu també</h2>

<ul>
 <li>Elements de seccionament semàntics:&nbsp; {{HTMLElement("section")}}, {{HTMLElement("article")}}, {{HTMLElement("nav")}}, {{HTMLElement("header")}}, {{HTMLElement("footer")}}</li>
 <li>{{HTMLElement("span")}} element per a l'estil de contingut estàtic.</li>
</ul>

<div>&nbsp;</div>
Revert to this revision