Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,25 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Title here</title>
<script defer src="quotes.js"></script>
<title>Quote generator app</title>

<link rel="stylesheet" href="style.css" />

<!-- defer ensures JS loads after the page elements are ready -->
<script src="quotes.js" defer></script>
</head>
<body>
<h1>hello there</h1>
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
<!-- Outer orange container -->
<div class="outer-container">
<!-- Your original title -->
<h1>hello there</h1>

<!-- Inner white card -->
<div class="quote-box">
<p id="quote"></p>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there some semantic html you could use here, in place of multiple nested divs?

@fromonda fromonda Aug 10, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the HTML to use more semantic elements instead of multiple nested div elements.

<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
</div>
</div>
</body>
</html>
15 changes: 15 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,18 @@ const quotes = [
];

// call pickFromArray with the quotes array to check you get a random quote

const quoteElement = document.querySelector("#quote");
const authorElement = document.querySelector("#author");
const newQuoteButton = document.querySelector("#new-quote");

function displayRandomQuote() {
const randomQuote = pickFromArray(quotes);

quoteElement.textContent = randomQuote.quote;
authorElement.textContent = randomQuote.author;
}

displayRandomQuote();

newQuoteButton.addEventListener("click", displayRandomQuote);
83 changes: 82 additions & 1 deletion Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,82 @@
/** Write your CSS in here **/
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}

body {
background-color: #f3a83c;
font-family: Georgia, "Times New Roman", Times, serif;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}

/* Container for heading + card */
.outer-container {
width: 90%;
max-width: 650px;
text-align: center;
}

/* Heading styling */
h1 {
color: white;
font-family: Arial, sans-serif;
margin-bottom: 20px;
font-size: 28px;
}

/* The white quote card */
.quote-box {
background-color: #ffffff;
padding: 45px;
text-align: left;
position: relative;
}

/* Quote text styling with orange quote mark added automatically */
#quote {
color: #f3a83c;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I check the accessiblity with lighthouse, it tells me there is insufficient contrast, did you spot this when testing?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not have time to carry out Lighthouse testing before submitting the task, as I was balancing the available time with completing the task requirements. Please bear in mind that finding this balance is an important skill to have in the workplace. However, I have now improved the contrast based on the Lighthouse feedback, and I hope that the task will still be considered complete.

font-size: 22px;
line-height: 1.4;
margin-bottom: 15px;
}

#quote::before {
content: "“ ";
font-size: 40px;
font-weight: bold;
line-height: 0;
vertical-align: -8px;
}

/* Author text styling right-aligned */
#author {
color: #f3a83c;
font-size: 18px;
text-align: right;
margin-bottom: 25px;
}

#author::before {
content: "- ";
}

/* Button styled and pushed to bottom right */
#new-quote {
display: block;
margin-left: auto;
background-color: #f3a83c;
color: #ffffff;
border: none;
padding: 12px 22px;
font-size: 15px;
font-family: Arial, sans-serif;
cursor: pointer;
}

#new-quote:hover {
opacity: 0.9;
}
Loading