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

responsivo con @media con css

nathan 200

@Hardcore01

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


DIFICIL- el responsivo para colocar los elementos dentro del <div> principal. tambien los adornos del texto. AREA DEL CODIGO NO SEGURO-en la parte del css con la colocacion mediante el margin, para centrar la tarjeta, el cual es el <div> principal.

Community feedback

Hyron 5,870

@hyrongennike

Posted

Hi @Hardcore01,

Nice job on your first attempt of the challenge

You can add the following to your CSS file to position the card in the middle of the page.

ody {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.contp {
    margin: 0;
}

Marked as helpful

1

nathan 200

@Hardcore01

Posted

@hyrongennike Gracias bro...!

0
Lucas 👾 104,420

@correlucas

Posted

👾Hi Nathan, congratulations for your first solution!👋 Welcome to the Frontend Mentor Coding Community!

Great start and great first solution! You’ve done really good work here putting everything together, I’ve some suggestions you can consider applying to your code:

1.The approach you've used to center this card vertically is not the best way, because using margins you don't have much control over the component when it scales. My suggestion is that you do this alignment with flexbox using the body as a reference for the container. The first thing you need to do is to remove the margins used to align it, then apply min-height: 100vh to make the body height size becomes 100% of the screen height, this way you make sure that whatever the situation the child element (the container) align the body with display: flex and align-items: center / justify-items: center.

2.THE PICTURE TAG is a shortcut to deal with the multiple images in this challenge. So you can use the <picture> tag instead of importing this as an <img> or using a div with background-image. Use it to place the images and make the change between mobile and desktop, instead of using a div or img and set the change in the css with display: none with the tag picture is more practical and easy. Note that for SEO / search engine reasons isn’t a better practice import this product image with CSS since this will make it harder to the image. Manage both images inside the <picture> tag and use the html to code to set when the images should change setting the device max-width depending of the device desktop + mobile.

Check the link for the official documentation for <picture> in W3 SCHOOLS: https://www.w3schools.com/tags/tag_picture.asp

✌️ I hope this helps you and happy coding!

Marked as helpful

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