Design comparison
Solution retrospective
The most challenging part for me was working with the responsivity in different screen sizes while keeping the image in the correct position.
Community feedback
- @correlucasPosted about 2 years ago
👾Fala Ághata , tudo bem? Parabéns pelo seu primeiro desafio e seja bem vinda a comunidade do Frontend Mentor!
Primeira solução e vc ja entrega um ótimo desafio, mandou bem! Aqui algumas dicas pra vc:
O valor da sombra do componente está um pouco forte, você pode melhorar isso colocando menos
opacity
e maisblur
, aqui um valor bom pra essa sombra:box-shadow: 5px 5px 15px 5px rgb(0 0 0 / 5%);
Esse desafio é uma ótima oportunidade pra usar grid, se vc quiser tentar aqui está o passo a passo:
Defina seu
width
comomax-width: 900px
(é o tamanho do contêiner) edisplay: grid
/grid-template-column: 1fr 1fr
(isso significa que seu componente terá duas colunas com 50% da largura do contêiner cada uma é ** 50px**)👋 Espero ter ajudado e continue no foco!
Marked as helpful1@a-almeida10Posted about 2 years ago@correlucas Olá, Lucas! Muito obrigada pelo feedback e pelo incentivo! A sombra ficou muito mais suave com o valor que você sugeriu. :D
1 - @elaineleungPosted about 2 years ago
Hi Ághata, welcome to Frontend Mentor, and congratulations on completing your first challenge! 😊
I know what you mean about the responsiveness in this challenge, as I also see many people struggling with keeping things at an optimal size when the layout shifts. Here are some suggestions I have based on what I'm seeing in your code:
-
Right now I can only see a desktop image and not the mobile one. To put both images within the HTML, you can try using the
img
tag like this, wheresrcset
contains your images and the width of the image inw
, andsizes
would specify the breakpoint you use as well as the preferred image, andsrc
would be the initial image for the initial view you have:<img alt="perfume bottle" srcset="images/image-product-desktop.jpg 600w, images/image-product-mobile.jpg 686w" sizes="(max-width: 745px) 686px, 600px" src="images/image-product-desktop.jpg">
Be sure also to add
object-fit: cover;
on theimg
as well, otherwise it will be distorted! -
Right now when I resize the browser, the card would start to get really small; this is because of the viewport units you're using for the card (
width: 33vw
andheight: 50vh
) and the 100vh for the main container (this should be on the body selector instead of the container). What I would do is, I would remove all these as well as the height on the image. For the card container, I would addwidth: min(100%, 600px)
, which just tells the browser to choose the smaller value between these two values. Basically, this would make sure the card does not get past 600px in the desktop view. For the mobile view, you can also do the same thing with setting a limit (trywidth: min(100%, 450px)
). I would also change the grid columns in the desktop view togrid-template-columns: 1fr 1fr
so that the columns would be even, while for mobile view, I would remove the 100vh height if it's still there and also remove thegrid-template-rows
. At this point, you shouldn't need theoverflow: hidden
anymore. -
To make everything centered, I would add these lines to the body selector, and I would put the background color here instead of the main container:
body { display: grid; place-content: center; min-height: 100vh; background-color: hsl(30, 38%, 92%); }
Your body selector is the main canvas, and so you'd always want the
background-color
here as well as themin-height
.
Here is my solution to this challenge in case you're interested: https://www.frontendmentor.io/solutions/card-component-using-cube-css-tNaBY0y_Nx. Hope some of these suggestions can help you with tackling responsiveness!
Marked as helpful1@a-almeida10Posted about 2 years ago@elaineleung Hello! Thank you so much for your feedback! That was incredibly helpful, I spent a lot of time struggling with responsiveness and now I can see clearly where I was failing and it will be very useful for my following projects. :D
1 -
- @AdrianoEscarabotePosted about 2 years ago
Oi Ághata, tudo bem?
Bem-vinda ao Front-end Mentor. Gostei bastante do seu projeto. Tenho algumas dicas que penso que você ira gostar:
1- Document should have one main landmark, você poderia ter colocado todo o conteudo na tag main, deixaria o código melhor estruturado. clica aqui para ler sobre
2- Page should contain a level-one heading clica aqui
3- Images must have alternate text, para que as pessoas que usam app que auxiliam elas a navegar na web entenderem o que está na tela.
4- Vi que você colocou uma unidade de medida relativa para sustentar o card, mas o card está variando muito de tamanho e isso está quebrando um pouco layout, o meu conselho é que você poderia fazer esta mudança para uma unidade fixa para resoluções maiores, e com o auxílio do media query fazer a mudança para uma unidade relativa quando a resolução estiver do tamanho mobile.
O resto ficou ótimo. Espero que ajude... não esqueça de marcar como útil 👍
Marked as helpful1@a-almeida10Posted about 2 years ago@AdrianoEscarabote Oi, Adriano, estou bem, e você? Muito obrigada pelo feedback! Os links foram super úteis, e eu havia mesmo esquecido do alt para as imagens.
0 - @khaleed2002Posted about 2 years ago
that's a good design. I recommend you to use letter-spacing in the "Perfume" element it will be the same as the original design. keep going:)
Marked as helpful1@a-almeida10Posted about 2 years ago@khaleed2002 Thank you for your feedback! I was wondering how to do that spacing :D
0
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