pseudoelemento ::after
Publicado por Julio (14 intervenciones) el 10/12/2017 23:32:17
En este ejemplo, si yo le pongo "display: block;" al :after, este ignora la propiedad "text-align" del h2. Pero cuando el :after tiene "display:inline-block", este si hace caso a text-align. ¿Cierto?
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
<!DOCTYPE html>
<html>
<head>
<title>HTML5</title>
<meta charset="utf-8">
<style>
body {
margin: 0;
padding: 0;
font-family: serif;
background: #222
}
h1 {
text-align: center;
color: #aaa;
}
h2 {
text-align: center;
color: #999;
font-size: 40px;
}
h2:after{
content: "";
display: block;
width: 25px;
height: 25px;
background: red;
}
</style>
<script>
</script>
</head>
<body>
<h2>10</h2>
</body>
</html>
Valora esta pregunta
0