Created
December 27, 2022 19:39
-
-
Save belsayed/f089ecabc07edd0d42271ffbc6079d53 to your computer and use it in GitHub Desktop.
Inspirational qoute
This file contains hidden or 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
<body> | |
<header> | |
<img src='https://www.onetrust.com/wp-content/themes/onetrust/images/OT-logo-green-158x50.svg' alt="Logo"> | |
<h1>Quote Of The day</h1> | |
</header> | |
<div id="quote-container"></div> | |
<script src="script.js"></script> | |
<footer> | |
<span>Demo Page. 2023. OneTrust </span> | |
</footer> | |
</body> | |
This file contains hidden or 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
const options = { | |
method: 'GET', | |
headers: { | |
'X-RapidAPI-Key': '6c33e37255msh10538d65e3ad94ep14a0bejsna53475ec04f8', | |
'X-RapidAPI-Host': 'famous-quotes4.p.rapidapi.com' | |
} | |
}; | |
fetch('https://famous-quotes4.p.rapidapi.com/random?category=all&count=1', options) | |
.then(response => response.json()) | |
.then(response => { | |
const quoteText = response[0].text; | |
const quoteAuthor = response[0].author; | |
const quoteContainer = document.getElementById('quote-container'); | |
quoteContainer.innerHTML = ` | |
<p id="quote">${quoteText}</p> | |
<p id="author">- ${quoteAuthor}</p> | |
`; | |
}) | |
.catch(err => console.error(err)); |
This file contains hidden or 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
@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,wght@1,300&display=swap'); | |
#quote { | |
font-size: 2em; | |
font-style: italic; | |
color: #666; | |
font-family: 'Nunito Sans', sans-serif; | |
margin-bottom: 20px; | |
} | |
#author { | |
font-size: 1.6em; | |
font-style: italic; | |
color: #999; | |
text-align: right !important; | |
margin-right: 20px; | |
font-family: 'Nunito Sans', sans-serif; | |
} | |
body { | |
text-align: center; | |
font-family: 'Nunito Sans', sans-serif; | |
} | |
#quote-container { | |
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); | |
border: 1px solid #333; | |
width: 50%; | |
margin: 30px auto; | |
} | |
footer { | |
background-color: #468254; | |
color: white; | |
padding: 20px; | |
font-family: 'Nunito Sans', sans-serif; | |
height: 10%; | |
} | |
header { | |
display: flex; | |
align-items: center; | |
background-color: #468254; | |
color: white; | |
padding: 10px; | |
font-family: 'Nunito Sans', sans-serif; | |
} | |
header img { | |
border-radius: 5px; | |
padding: 6px; | |
background-color:white; | |
margin-right:20px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment