Random Quote Generator
/* styles.css */
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
padding: 0;
}
.container {
text-align: center;
}
h1 {
color: #333;
}
#quote-container {
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
#quote-text {
font-size: 24px;
margin-bottom: 20px;
}
#new-quote-btn {
background-color: #3498db;
color: #fff;
border: none;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
border-radius: 5px;
}
// scripts.js
async function getRandomQuote() {
const response = await fetch('https://zenquotes.io/api/random');
const data = await response.json();
const quote = data[0].q;
document.getElementById('quote-text').textContent = `"${quote}"`;
}
getRandomQuote();
No comments:
Post a Comment