B. El selector #identificador

Ejemplo

Salida

Ábrelo en otra pestaña.

Revísalo en gilpgedit.

1<!DOCTYPE html>
2<html lang="es">
3<head>
4 <meta charset="UTF-8">
5 <meta name="viewport"
6 content="width=device-width">
7 <title>
8 Selector #identificador
9 </title>
10 <style>
11 /* Seleciona el elemento con
12 * id="neg" */
13 #neg {
14 /* negritas */
15 font-weight: bold;
16 }
17
18 /* Seleciona el elemento de tipo
19 * p
20 * con
21 * id="otro" */
22 p#otro {
23 /* mayúsculas */
24 text-transform: uppercase;
25 }
26
27 /* Seleciona el elemento de tipo
28 * h1
29 * con
30 * id="chas".
31 * No se aplica porque el único
32 * elemento con
33 * id="chas"
34 * es de tipo
35 * p */
36 h1#chas {
37 color: green;
38 }
39 </style>
40</head>
41<body>
42 <h1>Selector #identificador</h1>
43 <p>Uno.</p>
44 <p id="chas">Dos.</p>
45 <p>Tres.</p>
46 <p id="otro">Cuatro.</p>
47</body>
48</html>
skip_previous skip_next