Design comparison
Solution retrospective
Hello coders! I'm happy to introduce you my next small project with very little plain JS. Despite this work is pretty easy, I still had some projects with card size and buttons transition (I will note it further). I'm looking forward to seeing your help and recommendations. Problems:
- "Learn more" buttons (card 1 and 3) have abrupt animation, though the middle one is normal.
- Second card size. According to the overview, the middle card has to be bigger than the two other, I've done my project via the flexbox, I think if I used grid, I would do it properly. Thank you again and for your future answers!
Community feedback
- @pikapikamartPosted over 3 years ago
Hey good work on this one. Regarding your question well here it is
- The reason that it is "abrupt" is that, you are transitioning the background-color am I right, in this block of yours
color: hsl(237, 63%, 64%); background: transparent; border: 1px solid hsl(237, 63%, 64%); /* transition-duration: 1s;
Well it won't work because the reason is that, you set this
background: linear-gradient( 90deg , rgb(163, 168, 240), rgb(105, 111, 221));
in your.more-btn
and you are not transitioning any background-color at all sincelinear-gradient
is not background-color at all, rather it isbackground-image
and you cannot transitionbackground-image
tobackground-color
. Unlike your middle button, it will transition this because there is a styling that declares a background-color to it, this is the styling.block-2 .more-btn { background: white; color: hsl(237, 63%, 64%); }
and this will allow you to transition it. Remember that linear-gradient won't work in transitioning background colors.- Well you can make use of
transform: scaleY()
to that second block so that will will scale only the Y-axis of it. But keep in mind that doing this, it will resize your components inside of it. So if you we to do this, you can adjust only a small margin of it liketransform: scaleY(1.1)
If you need any more help, just drop it here^
1@maksimcoderPosted over 3 years agoHello, Pikamart, thanks a lot for your answer I really forgot about linear-gradient which can't be transitioned. Moreover, I'll fix the middle card asap. Thanks a lot!
0@pikapikamartPosted over 3 years ago@maksimcoder Your welcome on that and well, ughm, the other day I tried to transition linear gradient as well hahahha
0 - @RayaneBengaouiPosted over 3 years ago
Hello Maksim Deviatilov,
First of all, congrats for the challenge !
-
I think your transition is not working for cards 1 and 3 because you are trying do transition to a linear-gradient background which I believe might be impossible. So for example, if you replace your
background: linear-gradient(90deg, rgb(163, 168, 240),rgb(105,111,221));
with a simplebackground: purple
the transition should work. -
For the second card you could just create a modifier class to adjust the height, so working with flexbox is not a problem here 😉
Overall, well done for the challenge and happy coding ! 😃
0@maksimcoderPosted over 3 years agoHi, RayaneBengaoui, thank you for your help and I will fix my middle card and gradient asap. Have a nice day!
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