<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Quotes Generator</title>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div class="container">
<div class="quote"></div>
<div class="author"></div>
</div>
<script src="./script.js" type="text/javascript"></script>
</body>
</html>
@import url('https://fonts.googleapis.com/css2?family=PT+Sans&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
*::before,
*::after {
box-sizing: border-box;
}
html,
body {
font-size: 10px;
font-family: 'PT Sans','lato', Arial, Helvetica, sans-serif;
}
body {
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.container {
padding: 3.5rem;
max-width: 70rem;
}
.quote {
font-size: 3rem;
margin-bottom: 3rem;
}
.author {
font-size: 2rem;
font-style: italic;
letter-spacing: 1px;
}
const quoteElement = document.querySelector('.quote');
const authorElement = document.querySelector('.author');
const link = `https://api.quotable.io/random`;
function getQuote(){
fetch(link)
.then(response => {
let data = response.json();
return data;
})
.then(data => {
quoteElement.innerText = `“${data.content}”`;
authorElement.innerText = `―${data.author}`;
})
.catch(error => {
console.log(error);
});
}
window.addEventListener('load', getQuote);
Latest posts by ideasorblogs (see all)
- Create a Python program to find the DNS record - November 26, 2023
- Billing system using Python project with source code - November 20, 2023
- Python Programming questions with real examples PDF & slides - October 31, 2023