Skip to content

Instantly share code, notes, and snippets.

@untalsanders
Created May 22, 2021 21:11
Show Gist options
  • Save untalsanders/74b555fb6fc435f42e00cf26c0b2ad2c to your computer and use it in GitHub Desktop.
Save untalsanders/74b555fb6fc435f42e00cf26c0b2ad2c to your computer and use it in GitHub Desktop.
Layout for Images Side-by-Side

Layout Images Side-by-Side

Layout Images Side-by-Side

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Images Side-by-Side</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="mosaic">
<img src="https://i.imgur.com/bpuvcIu.jpg" alt="ivan-duque">
<span class="vs">vs</span>
<img src="https://i.imgur.com/v753Qi8.jpg" alt="gustavo-petro">
</div>
<h2>¿Quién será el próximo presidente de nuestra querida y amada Colombia?</h2>
</div>
</body>
</html>
@charset 'UTF-8';
@import url('https://fonts.googleapis.com/css2?family=Lato&display=swap');
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: Lato, sans-serif;
}
.container {
/* Flex */
height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.container h2 {
font-size: 1.8rem;
line-height: 60px;
}
.mosaic {
/* Flex */
display: grid;
grid-template-columns: minmax(min-content, max-content) auto minmax(min-content, max-content);
align-items: center;
justify-content: space-between;
grid-column-gap: 40px;
}
.mosaic > img {
border: 5px solid #eac683;
border-radius: 15px;
width: 320px;
height: 100%;
}
.mosaic > .vs {
font-size: 5rem;
text-transform: uppercase;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment