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:
<html>
<head>
<title>Formattazione dei testi</title>
</head>
<body>
<b>Questo testo è in grassetto</b>
<br />
<i>Questo testo è in corsivo</i>
<br />
<u>Questo testo è sottolineato</u>
<br />
<strike>Questo testo è barrato</strike>
<sub>Questo testo è in pedice</sub>
<sup>Questo testo è in apice</sup>
</body>
</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:
<html>
<head>
<title>Formattazione dei testi</title>
</head>
<body>
<p align=left>Questo testo è allineato a sinistra</p>
<p align=right>Questo testo è allineato a destra</p>
<p align=center>Questo testo è allineato a centro</p>
<p align=justify>Questo testo è giustificato</p>
</body>
</html>
Per allineare il testo al centro si può anche utilizzare il tag <center>:
<html>
<head>
<title>Formattazione dei testi</title>
</head>
<body>
<center><p >Questo testo è allineato al centro</p></center>
</body>
</html>
|