Submitted about 1 year ago
'Advice generator' app via HTML & CSS & JavaScript/TypeScript
@Koptelkin
Design comparison
SolutionDesign
Solution retrospective
Welcoming any feedback I have one unresolved moment - I need to replace divider.svg when layout changes from dekstop to mobile and back. How should i do it?
Community feedback
- @Zy8712Posted about 1 year ago
To answer your question, one way you can implement the divider.svg so that it changes for different screen sizes is using the <picture> tag. Here is what I did for mine:
<picture> <source media="(max-width:420px)" srcset="./images/pattern-divider-mobile.svg"> <img src="./images/pattern-divider-desktop.svg" alt="divider_img"> </picture>
What this does is that it uses the image inside the <img> tag by default, unless the screen size is less than 420px. You can do something similar to that.
Hope I was able to help 👍
1
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