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

NFT Preview Card Component using Vanilla CSS and Flex

Kate 170

@YayoKB

Desktop design screenshot for the NFT preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Community feedback

kristi 130

@kristiingco

Posted

Hey there! First off, great solution.

Using flex on the parent divs (your divs with the class of ".price" and ".time") will allow you to align the text and their respective images.

.price {
  color: var(--cyan);
  font-size: 1rem;
  font-weight: 400;
  display: flex;
}

.time {
  color: var(--soft-blue);
  font-size: 1rem;
  font-weight: 300;
  display: flex;
}

This, however, will result in the icons being "squished", due to the default alignment of the items being set to stretch. Thus, you have to add the "align-self" property to the CSS declarations you did for the icons.

.time img,
.price img {
  margin-right: 0.25rem;
  align-self: center;
}

I cloned your repo and added the above changes and it should look like this!

1

Kate 170

@YayoKB

Posted

@kristiingco Thanks! Adding flex worked :) Such a simple fix...

0
Mel 225

@Mel1207

Posted

Hi

you can try this properties and target these class .price and .time

  • display: flex;
  • align-items: center;

Hope it helps and great job for this work!

1

Kate 170

@YayoKB

Posted

@Mel1207 Thank you! This worked.

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