I am currently using Squarespace 7.1 to create a website that features a randomly generated quote in the footer section. The quote is generated from a JavaScript array when the page loads, reloads, or changes. Despite the code functioning as intended (tested on CodePen, JSFiddle, and my Squarespace site), I am struggling to style the output.
I have attempted to style the output using CSS and directly within the HTML container, but it only applies the default styles for that particular section of the page, which do not match the color, alignment, and size I desire for the quote.
Here is the basic HTML code:
<div class="Quote"></div>
Below is the JavaScript code:
function ShowQuote()
{
var Quote = [
"Where words fail, music speaks. — Hans Christian Andersen",
"Music is the language of the spirit. It opens the secret of life bringing peace, abolishing strife. — Kahlil Gibran",
// Remaining quotes omitted for brevity
];
var Pick = Math.floor(Math.random() * (Quote.length));
document.write(Quote[Pick]);
}
document.addEventListener("load", ShowQuote());
For reference, here are the CSS and HTML styling codes I have tried without success:
CSS:
.Quote {
display: flex;
font-family: "Poppins", sans-serif;
font-weight: 300;
font-style: Normal;
font-size: 1em;
line-height: 1.8em;
text-align: center;
color: #1B1B21;
}
HTML (this attempt converted the entire div container into a p element):
<p class="Quote" style="text-align:center;color:blue"></p>
I am seeking guidance on how to properly style the output from the array.