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

3-Column-preview-card-component

Raymond Visser•80
@Halaszraymond
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


Couldnt get rid of the white space between the elements, stackoverflow told to use font-size at parent object and that helped a bit, but not entirely... does anyone has any suggestions for solving this?

Code
Couldn’t fetch repository

Please log in to post a comment

Log in with GitHub

Community feedback

  • Hadiza•200
    @Thedeezat
    Posted about 3 years ago

    Hey Raymond 👋

    Nice work on this project 👏

    The whitespace between the containers, can be resolved using flexbox, you should try this out and see.

    .container {
      position: relative;
      width: 100%;
      background-color: hsl(0, 0%, 95%);
    }
    
    .card{
      height: 100vh;
      display: flex;
      justify-content: center;
      align-items: center;
      text-align: center;
     }
    
    @media screen and (max-width: 40rem) {
      .card {
        flex-direction: column;
        height: initial;
        padding: 5rem 0;
    }
    

    I decided to remove the transform property because flexbox already align the card for us vertically(as long as the height is 100vh) and horizontally, and also remove the whitespace between them.

    And It's also best to remove the default padding and margin using the universal selector in your css. And also instead of using px it's best to use Rem for font-size, it's a must for accessibility.

    * {
      margin: 0;
      padding: 0;
    }
    

    Well that's all, nice work again! i hope you find this useful.

  • Raymond Visser•80
    @Halaszraymond
    Posted about 3 years ago

    Awesome, thanks for the great feedback! I will try to look more into flexbox coming days!

  • Raymond Visser•80
    @Halaszraymond
    Posted about 3 years ago

    Awesome!! this worked:) thankyou very much! and Im also grateful for the recommendations of learning "Flexbox" and "CSS GRID"!

  • Grzegorz•130
    @GregW1994
    Posted about 3 years ago

    Hi!

    The gaps between your items is a result of a whitespace in your code - namely a line break (enter button) between divs. To get rid of it, simply remove line breaks between closing and opening tags of your <div> items. See below:

    Change this: </div> <div class="suvs">

      </div>
      <div class="luxury">
    

    To this: </div><div class="suvs">

      </div><div class="luxury">
    

    Learning "Flexbox", and later "CSS GRID" would make creating layout for the website a lot easier. I would recommend it as a next step in your learning journey :)

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

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

Oops! 😬

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

Log in with GitHub