<html lang="en">
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Random Quote Generator</title>
    <!-- Google Font -->
    <link
      href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap"
      rel="stylesheet"
    />
    <!-- Stylesheet -->
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <div class="wrapper">
      <div class="container">
        <p id="quote">
          Lorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptas,
          magni.
        </p>
        <h3 id="author">Lorem, ipsum.</h3>
        <button id="btn">Get Quote</button>
      </div>
    </div>
    <!-- Script -->
    <script src="script.js"></script>
  </body>
</html>
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}
body {
  background-color: #f43543;
}
.wrapper {
  width: 400px;
  position: absolute;
  transform: translate(-50%, -50%);
  top: 50%;
  left: 50%;
}
.container {
  width: 100%;
  background-color: #f43543;
  padding: 50px 40px;
  box-shadow: 0 20px 65px rgba(87, 11, 16, 0.5);
  position: relative;
  border-radius: 8px;
  text-align: center;
}
.container:after {
  content: "";
  position: absolute;
  width: 80%;
  height: 120%;
  background-color: #ffffff;
  z-index: -1;
  top: -10%;
  left: 10%;
}
.container p {
  color: #fdd8d8;
  line-height: 2;
  font-size: 18px;
}
.container h3 {
  color: #ffffff;
  margin: 20px 0 60px 0;
  font-weight: 600;
  text-transform: capitalize;
}
.container button {
  background-color: #ffffff;
  border: none;
  padding: 15px 45px;
  border-radius: 5px;
  font-size: 18px;
  font-weight: 600;
  color: #f43543;
  cursor: pointer;
}
let quote = document.getElementById("quote");
let author = document.getElementById("author");
let btn = document.getElementById("btn");

const url = "https://api.quotable.io/random";

let getQuote = () => {
  fetch(url)
    .then((data) => data.json())
    .then((item) => {
      quote.innerText = item.content;
      author.innerText = item.author;
    });
};

window.addEventListener("load", getQuote);
btn.addEventListener("click", getQuote);

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.