Solución del ejercicio CU01031D del curso CSS desde cero.
Código HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="Portal web">
<meta name="keywords" content="programar,cursos">
<link rel="stylesheet" type="text/css" href="estilos43.css">
<title>Ejemplo de background-attachment</title>
</head>
<body>
<div id="page">
<div id="header">
</div>
<div id="wrapper">
<div id="menu">
</div>
<div id="body">
<div id="a"></div>
<div id="b"></div>
<div id="c"></div>
<div id="d"></div>
</div>
</div>
<div id="footer">
</div>
</div>
</body>
</html>
Código CSS: "estilos43.css"
div div div div {
width: 400px;
height: 400px;
margin: 40px;
padding: 40px;
border: solid 2px;
}
#a {
background-image: url(1.jpg);
background-repeat: no-repeat;
background-position: center;
background-color: red;
}
#b {
background-image: url(2.jpg);
background-repeat: no-repeat;
background-position: center;
background-color: blue;
}
#c {
background-image: url(1.png);
background-repeat: no-repeat;
background-position: center;
background-color: yellow;
}
#d {
background-image: url(1.jpg);
background-repeat: no-repeat;
background-position: center;
background-color: green;
}