Skip to content

Instantly share code, notes, and snippets.

@robinparadise
Created October 2, 2024 09:39
Ejercicio 1: Flex + Grid
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Grid Template Areas</title>
<style>
body {
margin: 0;
font-family: Arial, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
main {
display: grid;
grid-template-areas: "topbar" "content";
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
header { grid-area: topbar; }
article { grid-area: content; }
.navbar {
display: flex;
justify-content: space-around; /* Espaciado uniforme */
align-items: center; /* Centrados verticalmente */
background-color: #111;
padding: 15px;
flex-wrap: wrap;
}
/* Elementos de la navegación */
.navbar a {
color: white;
text-decoration: none;
font-size: 18px;
padding: 10px;
}
.gallery {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 30px;
max-width: 600px;
margin: auto;
padding: 20px;
}
.gallery img {
width: 100%;
height: auto;
aspect-ratio: 1 / 1;
border-radius: 3%;
box-shadow: 8px 10px 20px #00000085;
filter: grayscale(.5);
/* filter: grayscale(.5) brightness(.5) */
object-fit: cover;
/* object-fit: none;*/
/* object-position: 6% 74%;*/
}
.gallery img:hover {
transform: scale(1.1);
transition: transform 300ms;
filter: grayscale(0);
box-shadow: 8px 10px 30px #000000dd;
}
</style>
</head>
<body>
<main>
<header>
<nav class="navbar">
<a href="#home">Home</a>
<a href="#about">About</a>
<a href="#services">Services</a>
<a href="#contact">Contact</a>
</nav>
</header>
<article>
<div class="gallery">
<img tabindex="0" src="https://images.unsplash.com/photo-1727324735318-c25d437052f7?q=80&w=2340&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D">
<img tabindex="0" src="https://images.unsplash.com/photo-1727207652611-59e981d73c48?q=80&w=2232&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D">
<img tabindex="0" src="https://images.unsplash.com/photo-1727108106379-f4ff1ba26ebc?q=80&w=2435&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D">
<img tabindex="0" src="https://images.unsplash.com/photo-1727282960386-4d2ccdc87ad0?q=80&w=2380&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D">
</div>
</article>
</main>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment