- index.html
- style.css
HTML
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>Márgenes que salen del contenedor</title>
<link rel="stylesheet" href="setting.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="block-1">
<div class="block-2">Bloque 2</div>
Bloque 1
</div>
</body>
</html>
CSS
body {
padding: 0 20px;
}
.block-1 {
height: 100px;
border: none;
text-align: center;
}
.block-2 {
margin-left: 20px;
margin-right: 20px;
text-align: center;
}
Ha ido a otra página
ObjetivosRealizado
0
- Asigna
margin-top: 20px;al segundo bloque. - Asigna
margin-top: 40px;al primer bloque. - Después, asigna
border: 1px solid white;al primer bloque. - Asígnale también
padding-top: 20px;.
Observa la separación entre el borde del primer bloque y el segundo bloque. Será de 40px (2 cuadritos).