aboutsummaryrefslogtreecommitdiff
path: root/files/it/web/html/element/center/index.html
blob: ca5a3d70c823b59bd5d4bcd2698e431bfe7d2d03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
title: <center>
slug: Web/HTML/Element/center
translation_of: Web/HTML/Element/center
---
<div>{{deprecated_header()}}</div>

<h2 id="Sommario">Sommario</h2>

<p>L'elemento HTML <strong><code>&lt;center&gt;</code></strong> è un elemento che può contenere paragrafi o altri elementi, che siano blocchi o inline. Il contenuto di questo elemento viene centrato orizzontalmente rispetto al suo contenitore (solitamente l'elemento {{HTMLElement("body")}}).</p>

<p>Questo tag è deprecato a partire da HTML 4 (e XHTML 1) in favore della proprietà <a href="/en-US/docs/Web/CSS" title="/en-US/docs/Web/CSS">CSS</a> {{Cssxref("text-align")}}, che può essere applicata ad un elemento {{HTMLElement("div")}} o ai singoli elementi {{HTMLElement("p")}}. Per centrare i blocchi usa altre proprietà CSS come{{Cssxref("margin-left")}} e {{Cssxref("margin-right")}}, e impostale ad <code>auto</code> (o importa {{Cssxref("margin")}}<code>0 auto</code></p>

<h2 id="Interfaccia_DOM">Interfaccia DOM</h2>

<p>Questo elemento implementa l'interfaccia {{domxref("HTMLElement")}}.</p>

<div class="note">
<p><strong>Nota:</strong> fino a Gecko 1.9.2 incluso, FIrefox implementa l'interfaccia {{domxref("HTMLSpanElement")}}.</p>
</div>

<h2 id="Example_1" name="Example_1">Esempio 1</h2>

<pre class="brush: html notranslate">&lt;center&gt;Questo testo verrà centrato
&lt;p&gt;E anche questo paragrafo.&lt;/p&gt;&lt;/center&gt;
</pre>

<h2 id="Example_2" name="Example_2">Esempio 2 (usando i CSS)</h2>

<pre class="brush: html notranslate">&lt;div style="text-align:center"&gt;Questo testo verrà centrato.
&lt;p&gt;E anche questo paragrafo.&lt;/p&gt;&lt;/div&gt;
</pre>

<h2 id="Example_3" name="Example_3">Esempio 3 (usando i CSS)</h2>

<pre class="brush: html notranslate">&lt;p style="text-align:center"&gt;Questa linea verrà centrata.&lt;br&gt;
E anche questa.&lt;/p&gt;
</pre>

<h2 id="Notes" name="Notes">Nota</h2>

<p>Applicando {{Cssxref("text-align")}}<code>: center</code> a un elemento {{HTMLElement("div")}} o {{HTMLElement("p")}} si centra <em>il contenuto</em> di questi elementi, non gli elementi stessi.</p>

<h2 id="Vedi_anche">Vedi anche</h2>

<ul>
 <li>{{Cssxref("text-align")}}</li>
 <li>{{Cssxref("display")}}</li>
</ul>

<div>{{HTMLRef}}</div>