Responsive time dashboard using CSS Grid and Flexbox, using JSON data
Design comparison
Solution retrospective
I could not figure out how to keep the svg contained within its background div (mobile design). Also, is there an easy way to have a button be selected when the script loads, instead of when the button is pressed?
Community feedback
- @anglicusPosted over 2 years ago
On my solution, I used the SVGs as background images in my CSS using the
background-image
property rather than including them directly in the HTML. That keeps them contained, although you might also be able to achieve the same result by usingoverflow: hidden
if you want to keep them in the HTML.As far as having a pre-selected button, I think you could select the button you want to be pressed in your JS and
.click()
it when the page first loads, like this:document.getElementById("weekly").click()
.In my own solution, rather than switching the inner HTML of the elements when the button is clicked, I actually have separate daily, weekly and monthly elements displaying the data, and then use classes to determine which set of elements is visible. Then I have weekly show by default by applying those classes in the original HTML.
Marked as helpful1
Please log in to post a comment
Log in with GitHubJoin 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