-
-
Couldn't load subscription status.
- Fork 83
NW6 | Sabella Fisseha | Module JS-3 -Programmer Humour | WEEK-3 #299
base: main
Are you sure you want to change the base?
Conversation
|
| return fetch("https://xkcd.now.sh/?comic=latest") | ||
| .then((res) => { | ||
| if (!res.ok) { | ||
| throw new Error("error"); |
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.
Make sure your errors always give some more information about what went wrong. If you just see the text "error", you might be confused about what actually happened
| margin-bottom: 20px; | ||
| } | ||
|
|
||
| #comic-container { |
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.
This is a great opportunity to mention margin collapsing. Because your h1 and #comic-container have a bottom/top margin, and they are next to each other (or more technically they are 'adjacent siblings'), their margins 'collapse' into a single 20px margin.
This basically means that your margin-top isn't having any affect.
My personal preference here is to avoid margin-top and only apply margin-bottom to elements arranged vertically, so it's really clear which margins are being applied. In that case, the h1 would have a bottom margin, and the #comic-container wouldn't have any margin at all.
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.
Looking good, Sabella! 🚀
I've left some comments if you want to dive deeper into what we covered here, but well done on a great little app!



Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.