Responsive Results Summary Component using CSS and JavaScript

Solution retrospective
Using JavaScript to manipulate HTML DOM and populate content dynamically.
What specific areas of your project would you like help with?In this solution, I stored data in a JavaScript Array. I would like help with any function of fetching data from data.json to populate data dynamically using JavaScript.
Please log in to post a comment
Log in with GitHubCommunity feedback
- @Outstandinggirl13
I really like that you kept your code simple and readable, and how you used grid for positioning elements — well done! Based on what I see in your code, I have a couple of tips:
First, try using semantic elements like
<main>
,<section>
,<article>
, and<footer>
instead of relying only on<div>
s to improve the semantics of your HTML. These elements help assistive technologies communicate the content's structure and hierarchy more effectively, which is crucial for individuals with disabilities.Also, if you want your
<div class="main">
element to be centered in the viewport, I recommend changing the position of the attribution to fixed. This will take the attribution element out of the document flow, preventing your main element from being shifted up. Try adding the following code to the attribution:.attribution { position: fixed; bottom: 0; }
.I see that fetching data from the JSON file works perfectly now — you figured out how to fix the error too :) For your JavaScript code, I have a small suggestion: it’s generally better to declare variables with
const
orlet
instead ofvar
to avoid unexpected behavior related to variable scope.Hopefully, these tips will be useful for you!
Marked as helpful - @iamprincetj
Congrats on finishing this challenge, with fetching data in your data.json file you can still use fetch('data.json').
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord