@DonHeidi
Posted
Hey Simon,
this looks good! regarding your questions. If you are using width: 100vw; you could introduce something like horizontal scrolling where you don't want it. As you are using flexbox you should not need to specify the width as flexbox is spanning over the full width.
Using height: 100vh: will work on Chrome but not on Edge for example and will fail on mobile views because of the dynamic address bar that is showing up after page load but hides when scolling down. It is possible to use dynamic viewport height, height: 100dvh:, or the small viewport height, height: 100svh; which is the smallest height the viewport could have, which can be better as the dynamic viewport height will change.
Kevin Powell made a good video about this, which you can find here: The problems with viewport units
You can use height on the card but you don't have to. You can achieve a similar result by using something like this on your .card class
display: flex:
flex-direction: column;
gap: 1rem; /* just an example */
padding-bottom: 1.5rem;
By using gap, paddings and maybe margin on the card contents, you will achieve a responsive layout for the card with overall more control. The card height will adjust to its content this way.
Hope this helps and happy coding!
Marked as helpful
@simoncodes-dev
Posted
@DonHeidi This is incredibly helpful, thank you! I'll make a couple of adjustments! I visited the component on mobile and found that it was looking awful, so had to make some adjustments already.