generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 155
Glasgow | ITP May 2025 | Adiyah Farhan | Sprint 3 | Quote Generator App #742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AdiyahFarhan
wants to merge
4
commits into
CodeYourFuture:main
Choose a base branch
from
AdiyahFarhan:Sprint-3/Quote-Generator
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+81
−6
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1d29883
Update the script quotes.js to display random quote from the array of…
AdiyahFarhan d7172be
Write the CSS code for Quote generator app
AdiyahFarhan 16a63d1
Update the title of the index.html
AdiyahFarhan 74d3d92
Restoring the script tag on the head with the defer attribute, It doe…
AdiyahFarhan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,55 @@ | ||
/** Write your CSS in here **/ | ||
body { | ||
background-color: darkgoldenrod; /* Light gray background */ | ||
display: flex; | ||
flex-direction: column; /* Stack children vertically */ | ||
justify-content: center; /* Center horizontally */ | ||
align-items: center; /* Center vertically */ | ||
height: 100vh; | ||
margin: 0; | ||
color: beige; | ||
} | ||
|
||
.quote-container { | ||
display: flex; | ||
flex-direction: column; /* Stack quote and author vertically */ | ||
background-color: lightgray; | ||
padding: 20px; | ||
border-radius: 10px; | ||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); | ||
font-weight: bold; | ||
color: darkslategray; | ||
max-width: 600px; /* Limit the width of the quote container */ | ||
} | ||
|
||
h1 { | ||
font-size: 2.5em; | ||
margin-bottom: 20px; | ||
color: darkslategray; | ||
} | ||
|
||
p { | ||
margin: 10px 0; | ||
} | ||
|
||
p#quote { | ||
font-style: italic; | ||
text-align: center; | ||
font-size: 1.5em; | ||
} | ||
|
||
p#author { | ||
text-align: right; | ||
font-weight: normal; | ||
} | ||
|
||
#new-quote { | ||
background-color: darkgoldenrod; | ||
color: white; | ||
border: none; | ||
padding: 10px 20px; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
} | ||
#new-quote:hover { | ||
background-color: darkslategray; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why the originally script tag was up on the head tag (not in the bottom of body) and what
defer
attribute does here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we use <script> tag up on the tag, without the defer attribute then it downloads and executes the script before parsing the complete file. As a result, the script that tries to access the elements in the that haven't been parsed yet, t will return null because the element doesn’t exist in the DOM yet.
But if we use a defer attribute, it will just download the script on the head but executes the script after the is fully parsed. So by adding defer attribute, we can avoid any blocking issues that makes script to behave improperly.