Skip to content

Commit

Permalink
completed rif
Browse files Browse the repository at this point in the history
  • Loading branch information
tsr-kairi committed Jul 14, 2021
1 parent 813b7a1 commit 29b9ca1
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Day 48 - Random Image Feed/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const container = document.querySelector(".container");
const unsplashURL = "https://source.unsplash.com/random/";

const rows = 12;

for (let i = 0; i < rows * 3; i++) {
const img = document.createElement("img");
img.src = `${unsplashURL}${getRandomSize()}`;
container.appendChild(img);
}

function getRandomSize() {
return `${getRandomNr()}x${getRandomNr()}`;
}

function getRandomNr() {
return Math.floor(Math.random() * 12) + 300;
}
16 changes: 16 additions & 0 deletions Day 48 - Random Image Feed/index.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!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="./style.css" />
<title>Random Image Feed</title>
</head>
<body>
<h1>Random Image Feed</h1>
<div class="container"></div>

<script src="./app.js"></script>
</body>
</html>
37 changes: 37 additions & 0 deletions Day 48 - Random Image Feed/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
*::after,
*::before {
box-sizing: border-box;
margin: 0;
padding: 0;
}

body {
background-color: #f4f4f4;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
margin: 0;
}

.title {
margin: 10px 0 0;
text-align: center;
}

.container {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
max-width: 1500px;
}

.container img {
object-fit: cover;
margin: 10px;
height: 300px;
width: 300px;
max-width: 100%;
}

0 comments on commit 29b9ca1

Please sign in to comment.