,

Guida HTML Capitolo 9° – Formattazione dei testi

Il testo si può formattare grazie a vari tag.

E opportuno dire che molti di questi tag sono stati dichiarati obsoleti dal W3C o comunque ormai vengono poco utilizzati, perché sostituiti dai CSS.

Le varie formattazioni che può avere un testo sono:

  • <b>  o <strong>  -> Grassetto
  • <i>   -> Corsivo
  • <u>  -> Sottolineato
  • <strike>  ->  barrato
  • <sub>  -> in pedice
  • <sup>  -> in apice

Ecco un breve esempio che dimostra la tabella:

01.<html>
02.<head>
03.<title>Formattazione dei testi</title>
04.</head>
05.<body>
06.<b>Questo testo è in grassetto</b>
07.<br />
08.<i>Questo testo è in corsivo</i>
09.<br />
10.<u>Questo testo è sottolineato</u>
11.<br />
12.<strike>Questo testo è barrato</strike>
13.<sub>Questo testo è in pedice</sub>
14.<sup>Questo testo è in apice</sup>
15.</body>
16.</html>

Con lHTML si può anche decidere lallineamento di un testo. Questo si fa grazie allattributo align. Questo può avere quattro valori:

  • left  -> Testo allineato a sinistra
  • right  -> Testo allineato a destra
  • center  -> Testo allineato al centro
  • justify  -> Testo giustificato

Ecco un breve esempio:

01.<html>
02.<head>
03.<title>Formattazione dei testi</title>
04.</head>
05.<body>
06.<p align=left>Questo testo è allineato a sinistra</p>
07.<p align=right>Questo testo è allineato a destra</p>
08.<p align=center>Questo testo è allineato a centro</p>
09.<p align=justify>Questo testo è giustificato</p>
10.</body>
11.</html>

Per allineare il testo al centro si può anche utilizzare il tag <center>:

1.<html>
2.<head>
3.<title>Formattazione dei testi</title>
4.</head>
5.<body>
6.<center><p >Questo testo è allineato al centro</p></center>
7.</body>
8.</html>

Pubblicato da Valentina

Valentina

La curiosità per il mondo tecnologico mi è stata trasmessa da mio padre fin da piccola e probabilmente per questo sono sempre stata abbastanza “nerd”. Ma questa è stata anche la mia grande fortuna, perchè la passione per questo mondo mi ha fatto trovare il lavoro dei miei sogni, scrivere ed approfondire questi argomenti per portarli all’attenzione di tutti! Grazie papà!