Design comparison
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
- @hyrongennikePosted about 2 years ago
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 helpful1 - @correlucasPosted about 2 years ago
👾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 applymin-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 withdisplay: flex
andalign-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 withbackground-image
. Use it to place the images and make the change between mobile and desktop, instead of using adiv
orimg
and set the change in the css withdisplay: 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 devicemax-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 helpful0
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