Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 6 months ago

article preview component using flex, grid, transition and position

Binh05•470
@Binh05
A solution to the Article preview component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What challenges did you encounter, and how did you overcome them?

I ran into issues with CSS selector specificity. The classes I added dynamically via JavaScript couldn't override the styles previously defined in my CSS. I wasn’t sure what keywords to search for, so I turned to AI for help.

Eventually, I realized the problem was caused by the fact that my original CSS used highly specific selectors, whereas the dynamically added classes had more generic selectors. For example:

  • before
.active {
...
}
  • after
.card .content-right .active {
...
}

However, more importantly, I’ve gained a much clearer understanding of how CSS specificity works.

What specific areas of your project would you like help with?

I was trying to make the drawer image overflow hidden when it exceeds the container boundaries. However, when I set height: 100% without specifying the width, it took up the full width of the screen instead of hiding the overflow content.

To work around this, I set width: 123%, which helped achieve the visual result I wanted.

.card .img img {
    width: 123%;
    height: 100%;
    border-top-left-radius: .5rem;
}

I'm not sure if this is a good solution, so I’d really appreciate any feedback or suggestions from others.

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Binh05's solution.

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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner
  • Use cases

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License