-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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%; | ||
} |