Latest solutions
Vanilla HTML, CSS, JS - Flexbox and Grid - Accessible News homepage
#accessibility#bemSubmitted over 1 year agoNo JS, Vanilla CSS, Flex, Mobile-first, Accessibility - FAQ Accordion
#accessibilitySubmitted over 1 year ago
Latest comments
- @PriyankaRC16@anar-sol
Hello =)
You are opening a
div
element before thebody
, it's an invalid HTML.body
is supposed to be the main element containing all the content of the page.You can use the W3C HTML validator to check your HTML.
Marked as helpful - @joseildoandrade12@anar-sol
Hello =)
If you want to include the image as HTML content instead of using CSS
background
, you can usepicture
andsource
to specify different images for mobile and desktop depending on the viewport size.In my solution, I've set the mobile version as the default image and the desktop one starting at
640px
width viewport.<picture> <source media="(min-width: 640px)" srcset="images/image-product-desktop.jpg" width="600" height="900"> <img src="./images/image-product-mobile.jpg" alt="Gabrielle Essence Eau De Parfum bottle" width="686" height="480" class="card__image"> </picture>
As you'll see in these MDN and web.dev articles, there are many other situations where
picture
andsource
can be useful.Marked as helpful - @shakil-02@anar-sol
Hello =)
Instead of using two separate
img
elements, you can usepicture
andsource
to specify different images for mobile and desktop depending on the viewport size.In my solution, I've set the mobile version as the default image and the desktop one starting at
640px
width viewport.<picture> <source media="(min-width: 640px)" srcset="images/image-product-desktop.jpg" width="600" height="900"> <img src="./images/image-product-mobile.jpg" alt="Gabrielle Essence Eau De Parfum bottle" width="686" height="480" class="card__image"> </picture>
As you'll see in these MDN and web.dev articles, there are many other situations where
picture
andsource
can be useful. - @Izzah-23@anar-sol
Hello =)
Instead of using CSS
background
to set the image, you can usepicture
andsource
HTML elements to specify different images for mobile and desktop depending on the viewport size.In my solution, I've set the mobile version as the default image and the desktop one starting at
640px
width viewport.<picture> <source media="(min-width: 640px)" srcset="images/image-product-desktop.jpg" width="600" height="900"> <img src="./images/image-product-mobile.jpg" alt="Gabrielle Essence Eau De Parfum bottle" width="686" height="480" class="card__image"> </picture>
As you'll see in these MDN and web.dev articles, there are many other situations where
picture
andsource
can be useful. - @RezoMoney@anar-sol
Hi =)
Instead of using CSS to change the image, you can use
picture
andsource
HTML elements to specify different images for mobile and desktop depending on the viewport size.In my solution, I've set the mobile version as the default image and the desktop one starting at
640px
width viewport.<picture> <source media="(min-width: 640px)" srcset="images/image-product-desktop.jpg" width="600" height="900"> <img src="./images/image-product-mobile.jpg" alt="Gabrielle Essence Eau De Parfum bottle" width="686" height="480" class="card__image"> </picture>
As you'll see in these MDN and web.dev articles, there are many other situations where
picture
andsource
can be useful.Marked as helpful - @Grunt395@anar-sol
Hello =)
Instead of using two separate
img
elements, you can usepicture
andsource
to specify different images for mobile and desktop depending on the viewport size.In my solution, I've set the mobile version as the default image and the desktop one starting at
640px
width viewport.<picture> <source media="(min-width: 640px)" srcset="images/image-product-desktop.jpg" width="600" height="900"> <img src="./images/image-product-mobile.jpg" alt="Gabrielle Essence Eau De Parfum bottle" width="686" height="480" class="card__image"> </picture>
As you'll see in these MDN and web.dev articles, there are many other situations where
picture
andsource
can be useful.Marked as helpful