Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Responsive landing page with only html and css

Lea 160

@Hatchino

Desktop design screenshot for the Product preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


At first I thought that the project would be very simple to carry out but I was wrong. I had difficulty centering the card, using flexbox, modifying the fonts (I couldn't put them in bold). I am not satisfied with my responsive. I had to tinker so that the button wouldn't come out of the card and I didn't know if everything had to fit on one page for the mobile version. I would like feedback on this part of my code.

Community feedback

Adriano 34,090

@AdrianoEscarabote

Posted

Hi Lea! How are you?

I really liked the design of the project, but I have some tips that I think you will like.

I noticed that you used flex-box in this challenge, the best would be to use grid, because we have more control of the columns.

I made some changes to show you and I would like you to do it too:

I changed the image size:

.card img {
    height: 460px;
    width: 300px;
}

I made the change to the grid:

.card {
    display: grid;
    grid-template-columns: repeat(2, 300px);
}

To have a code with better accessibility we will work with the picture tag in the html, to change the mobile image. link to read more about the tag --> click here

I removed the two img tags, and added:

<picture>
  <source media="(max-width:650px)" srcset="images/image-product-mobile.jpg" class="mobile">
  <img src="images/image-product-desktop.jpg" alt="Flowers" class="desktop">
</picture>

Now to make the switch from the mobile version, we will use a media query:

@media (max-width: 650px) {
    .card {
        grid-template-columns: repeat(1, 80%);
    }
}

Remember to prioritize relative measurement units.

The rest is really good!!

Hope this helps! 👍

Marked as helpful

1

Lea 160

@Hatchino

Posted

@AdrianoEscarabote Thank you for taking the time to write to me. I applied your advice by adding the picture tag. But with the mobile class I can't change the style of the image (change the size and the border).

0

Please log in to post a comment

Log in with GitHub
Discord logo

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