Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 2 years ago

Responsive preview card using html & css

Hassan Kachemela•40
@DrStranger1
A solution to the Stats preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What is the accent and how does it really work? Is it possible to use table tags only for the card? I found it quite difficult to work with the stats and their values Padding and margin were also difficult for me to work with I am a total beginner in this, and this is my first work, a help from experienced would mean everything

Code
Couldn’t fetch repository

Please log in to post a comment

Log in with GitHub

Community feedback

  • Hyron•5,870
    @hyrongennike
    Posted over 2 years ago

    to answer your first question you can add the following to add the overlay just remember to use the correct shade of purple.

    .photo {
        position: relative;
    }
    
    .photo::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        background: purple;
        width: 100%;
        height: 100%;
        opacity: 80%;
        mix-blend-mode: multiply;
    }
    

    you can remove the width and height on the image and add the following.

    img {
        width: 100%;
    }
    

    Also add the following there's a lot work that still needs to be done but this should send you in the right direction.

    body {
        background-color: hsl(233, 47%, 7%);
        font-family: 'Inter', sans-serif;
        font-size: 15px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
    }
    
    .flex-container {
        max-width: 1024px;
    }
    
    Marked as helpful
  • Hyron•5,870
    @hyrongennike
    Posted over 2 years ago

    Hi @DrStranger1,

    Good job on your first attempt of the challenge

    If you mean using a table for layout then it's a big no. That used to be a thing in past and it's not responsive. Also there's no reason to use it as you have flexbox and grid which makes this easier. below is a link to learn flexbox in a fun way.

    https://flexboxfroggy.com/

    This is if you want to learn CSS grid. https://cssgridgarden.com/

    You can also remove the margin on the .flex-container to center the card.

    Don't rush your learning process and in the process pick up bad practices

    There are a lot of tutorial on YouTube, if you click on resource in the menu there are tutorials take your time to learn.

    Marked as helpful

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
Frontend Mentor logo

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

Frontend Mentor

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

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

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit 1st-party linked stylesheets, and styles within <style> tags.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub