Design comparison
Solution retrospective
It been a couple weeks since I have made a design. Throughout this time I have been working on Javascript and mainly learning the fundamentals. I am proud that I finished another F.M solution in the 'Junior' standing. One step closer to becoming more proficient at Frontend.
Next time, I'd want to make this design responsive on majority designs and not just for devices with a max-width of 600px and less.
What challenges did you encounter, and how did you overcome them?I did come across a couple of challenges actually. One of them was working with the SVG image inside of my design. I tried to make the design as identical as possible and I know this was not the case.
I did some research on the "change" event in Javascript and how I can switch between SVG elements depending on the size of the screen. I did use matchMedia for this portion of the design and it actually helped.
const mediaQuery = window.matchMedia("(max-width: 600px)");
function mediaChanger(event) {
if (event.matches) {
imager.innerHTML = newSVG;
} else {
imager.innerHTML = oldSVG;
}
}
mediaQuery.addEventListener("change", mediaChanger); // matchMedia supports event "change"
mediaChanger(mediaQuery);
What specific areas of your project would you like help with?
I would like some help on how I can use margining and padding more efficient in this design. I acknowledged that my small absence in designing designs in HTML and CSS has caused me to be a little rusty when it comes to these fundamentals and would like some guidance to make my design more identical then how it looks.
If anyone can, in their free time, to look at my code and tell me what I can do for next time would be greatly appreciated.
Community feedback
- @dylan-dot-cPosted 4 days ago
Well done on this challenge and everything looks good.
There are a few things that you can improve on.
- weirdly you used js to change the SVG in respect to screen size, but you can actually do that without js! There is this magical element:
<picture/>
that you can use and specify a media attribute that will causes it to change at certain break points. So you can research that. - you can also use some more semantic HTML code as you are overusing divs just a little. You can use the section element and use the ul and li tags.
- for the lists, use the ul and li and you can put a div make it flex and use some spacing to separate them. -for the inputs you can make it a form as it would be more organized and used button[type=submit].
- for the svgs you can actually use them with the img tags like this
<img src="illustration.svg" />
The only drawback would be changing the SVG code when somethings happen like a hover you change the fill color(there is a few challenges like that) but overall you can do that to reduce the SVG code in your HTML file.
So you can just replace your whole js code and use the picture code.
Anyways take care and all the best!
0 - weirdly you used js to change the SVG in respect to screen size, but you can actually do that without js! There is this magical element:
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