p:first-letter {color: red; font-weight: bold;}
È possibile anche usare classi:
p.nome_classe:first-letter {color: red; font-weight: bold;}
o selettori di tipo ID:
#nome_id:first-letter {color: red; font-weight: bold;}
Per tutte le regole usate negli esempi il testo degli elementi presentera' la prima lettera rossa e in
grassetto.
Esempio
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento senza titolo</title>
</head>
<style>
p:first-child {color:red;}
p:first-letter {color: red; font-weight: bold;}
</style>
<body>
<div>
<p>blah blah blah</p>
<p>blah blah blah</p>
<table>
<tr>
<td>
<p>blah blah blah</p>
<p>blah blah blah</p>
</td>
</tr>
</table>
</body>
</html>
|