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

3-column preview card component

Josh•100
@Joshua-Farr
A solution to the 3-column preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


3-Column Preview Card Component:

I really enjoyed working on this project, it felt like the first time that things that I've been learning were starting to click. Theres still a long road ahead for my web dev journey but I will take the success of this project as a personal victory!

Wins:

  • Made use of a professional styling reset at the start of my styles.css file.
  • Able to solve problems using already existing documentation as I ran into them.
  • Felt really comfortable with applying basic flex-box styling to the elements.

Go Gets:

  • Try and find a simpler solution for handling element color changes. Felt like my CSS was not as optimized as it could have been.
  • Choose a challenge that requires the use of a CSS grid to force learning.
  • Try a harder HTML / CSS challenge (non-newbie)

One of the problems I ran into was on the hover states, the blocks would get pushed down. After some googling, I realized that the problem was caused by not having a border on the initial button state. Putting a border (albeit invisible) on the learn more buttons solved this issue!

Questions that I had while working on this project:

  • Will I run into specificity issues with having the h1 override the body font?
  • Is there a way to have the button color inherit the same color as the background or is the best way to separate it separately?
  • Is there a simpler solution for handling the button hover state changes?

Any additional feedback would be greatly appreciated!

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Abdul Khaliq 🚀•72,380
    @0xabdulkhaliq
    Posted about 2 years ago

    Hello there 👋. Congratulations on successfully completing the challenge! 🎉

    • I have other recommendations regarding your code that I believe will be of great interest to you.

    HEADINGS ⚠️:

    • This solution consists incorrect usage of <h1> so it can cause severe accessibility errors due to incorrect usage of level-one headings <h1>

    • Every site must want only one h1 element identifying and describing the main content of the page.

    • An h1 heading provides an important navigation point for users of assistive technologies, allowing them to easily find the main content of the page.

    • In this solution there's three <h1> elements, like this <h1>SEDANS</h1>, you can preferably use <h2> instead of <h1>. Remember <h1> provides an important navigation point for users of assistive technologies so we want to use it wisely

    • So we want to add a level-one heading to improve accessibility by reading aloud the heading by screen readers, you can achieve this by adding a sr-only class to hide it from visual users (it will be useful for visually impaired users)

    • Example: <h1 class="sr-only">3-column preview card component</h1>

    CSS 🎨:

    • Looks like you declared each background color for each button which needs to be change the background color during the hover, actually we can handle that issue with a the inherit value

    • Yes you're right there's a value which is used to inherit the parent element's background

    • So just add background: inherit for the button elements during hover additionally we replacing the border with outline they both work similar but outline doesn't consume extra space like border does.

    • Let's look an example
    button:hover {
    background-color: inherit;
    color: white;
    outline: 1px solid white;
    }
    

    • Now you can remove these individual declarations for the background for each button element
    .sedans a:hover {
    background-color: var(--bright-orange);
    border: 2px solid var(--very-light-gray);
    }
    .suv a:hover {
    background-color: var(--dark-cyan);
    border: 2px solid var(--very-light-gray);
    }
    .luxury a:hover {
    background-color: var(--very-dark-cyan);
    border: 2px solid var(--very-light-gray);
    }
    

    • Now you have gotten the desired result without hassling in an efficient way.

    • Pro tip: you can use transparent value for background property to get the same effect as `inherit.

    • If you have any questions or need further clarification, you can always check out my submission and feel free to reach out to me.

    .

    I hope you find this helpful 😄 Above all, the solution you submitted is great !

    Happy coding!

    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 all CSS, SCSS and Less files in your repository.

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.

How does the JavaScript validation report work?

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

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

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

Log in with GitHub