
El main se pone encima del header
Publicado por ImSaitam (2 intervenciones) el 03/09/2022 09:59:38
Hola. Soy relativamente nuevo en esto del html y del css y no le encuentro solucion a que mi MAIN esta encima del HEADER. ¿Alguno sabe cual es la solucion? Adjunto codigo HTML y CSS.
HTML:
CSS:
HTML:
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
47
48
49
50
51
52
53
54
55
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles/styles.css">
<link href="https://fonts.googleapis.com/css2?family=Raleway&display=swap" rel="stylesheet">
<link rel="shortcut icon" href="logoqatar.png" type="image/x-icon">
<title>Historia de los mundiales</title>
</head>
<body>
<div class="capa"></div>
<header class="header">
<div class="container">
<div class="btn-menu">
<label for="btn-menu">☰</label>
</div>
<h1 id="inicio"></h1>
<div class="logo">
</div>
<nav class="menu">
<a href="#">Inicio</a>
<a href="#">Nosotros</a>
<a href="#">Blog</a>
<a href="#">Contacto</a>
</nav>
</div>
</header>
<!-- -->
<input type="checkbox" id="btn-menu">
<div class="container-menu">
<div class="cont-menu">
<nav>
<a href="#">Portafolio</a>
<a href="#">Servicios</a>
<a href="#">Suscribirse</a>
<a href="#">Facebook</a>
<a href="#">Youtube</a>
<a href="memorabilia.html">Memorabilia</a>
</nav>
<label for="btn-menu">✖️</label>
</div>
</div>
<main>
<section>
<h1>Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptates dolores dolor, illo esse, animi repudiandae minima voluptas assumenda voluptatum id similique aspernatur doloremque itaque molestiae mollitia fuga? Aspernatur, dolores nemo!</h1>
</section>
</main>
</body>
</html>
CSS:
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
@import url('https://fonts.googleapis.com/css?family=Montserrat|Montserrat+Alternates|Poppins&display=swap');
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Raleway', sans-serif;
}
body{
background: url("background.jpg");
background-repeat: no-repeat;
}
.capa{
position: fixed;
width: 100%;
height: 100vh;
background: rgba(0,0,0,0.6);
z-index: -1;
top: 0;left: 0;
}
/*Estilos para el encabezado*/
.header{
width: 100%;
height: 100px;
position: fixed;
top: 0;left: 0;
}
/* ---------------- */
.container{
width: 90%;
max-width: 1200px;
margin: auto;
}
.container .btn-menu, .logo{
float: left;
line-height:100px;
}
.container .btn-menu label{
color: #fff;
font-size: 25px;
cursor: pointer;
}
.container .menu{
float: left;
line-height: 100px;
padding-left: 80px;
}
.container .menu a{
display: inline-block;
padding: 15px;
line-height: normal;
text-decoration: none;
color: #fff;
transition: all 0.3s ease;
border-bottom: 2px solid transparent;
font-size: 15px;
margin-right: 5px;
}
.container .menu a:hover{
border-bottom: 2px solid #c7c7c7;
padding-bottom: 5px;
}
/*Fin de Estilos para el encabezado*/
/*Menù lateral*/
#btn-menu{
display: none;
}
.container-menu{
position: absolute;
background: rgba(0,0,0,0.5);
width: 100%;
height: 100vh;
top: 0;left: 0;
transition: all 500ms ease;
opacity: 0;
visibility: hidden;
}
#btn-menu:checked ~ .container-menu{
opacity: 1;
visibility: visible;
}
.cont-menu{
width: 100%;
max-width: 250px;
background: #1c1c1c;
height: 100vh;
position: relative;
transition: all 500ms ease;
transform: translateX(-100%);
}
#btn-menu:checked ~ .container-menu .cont-menu{
transform: translateX(0%);
}
.cont-menu nav{
transform: translateY(15%);
}
.cont-menu nav a{
display: block;
text-decoration: none;
padding: 20px;
color: #c7c7c7;
border-left: 5px solid transparent;
transition: all 400ms ease;
}
.cont-menu nav a:hover{
border-left: 5px solid #c7c7c7;
background: #1f1f1f;
}
.cont-menu label{
position: absolute;
right: 5px;
top: 10px;
color: #fff;
cursor: pointer;
font-size: 18px;
}
/*Fin de Menù lateral*/
Valora esta pregunta


0