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

Product preview card component using CSS Flex

@aazs-edu

Desktop design screenshot for the Product preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


  • I'm not sure about sizes. I made it roughly as close to the design as i can (I don't have access to Figma design file).

Community feedback

P
Dean 480

@Deanogit

Posted

Hey Abdulrahman Zaki,

Your solution is looking fantastic! It is impressive to do this without the figma file

I was just looking at the styles.css file and noticed the technique being used to apply the classes with regards to specificity. I am not familiar with this technique, is there something in particular you'd like to achieve with this?

For example

section .container .info-box .product-category{
    text-transform: uppercase;
    font-family: var(--s-font);
    margin-bottom: 24px;
    letter-spacing: 4px;
    color: var(--iv-color);
}

This has a specificity of (0,3,1) This is calculated by the section element tag (0,0,1) And three class names (0,3,0)

I think I would instead write

.product-category{
    text-transform: uppercase;
    font-family: var(--s-font);
    margin-bottom: 24px;
    letter-spacing: 4px;
    color: var(--iv-color);
}

This has a single class name so the specificity is (0,1,0)

Taking a look at the documentation for specificity, it is my understanding its best to keep specificity as low as possible when applying property values to classes.

In a small project I'm not sure it makes too much difference but as I understand, when working on larger codebases, specificity might impact the maintainability of the project.

Let me know what you think,

Thanks for reading & great job on completing this challenge

Marked as helpful

1
abhijeet 30

@imabhijeet

Posted

Great work mate, Our solution can differ from the given prototype but the base design should be similar to it. One thing I would like to add that in your GitHub repo you didn't have any Readme file, maybe you missed it.

1

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