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

Responsive 3 Column Card Component

Jacob Seymour•50
@Jacwilalasey
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


Second challenge completed! (sort of)

I have 3 questions;

  • When resizing the screen down to mobile, the sub containers all spill over their content e.g. the text and buttons spill out the bottom, how do I manage this?

  • Also when resizing, the sub containers stack from a row, to two on top and one on bottom before going into a full column, how do I avoid this?

  • How to I get border-radius to work on only the 4 corners? each time I added it in, it would curve all 4 corners of each sub container.

Thanks everyone! Jac

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Leo•440
    @Souicia
    Posted almost 3 years ago

    Hello Jacob,

    Congratulation on finishing this design.

    Because there was a lot of possible improvements to your original code, I forked your entire project (which created a repository of your project onto my account), here's the link: https://github.com/Souicia/3-col-car-component-improvement

    Now to answer your specific questions. While @AtulKumar0001 answered correctly on the third question and with good details, I will explain the two first.

    The simplest answer to first question is to simply use height: auto on your .container-sub. This will automatically fit all the content inside the container.

    The answer to your second question is to avoid flex-wrap. Flex-wrap will make the containers jump to a new line if the space of the parent container becomes too small for all of them to fit.

    For the third question, read Atul answer.

    For more improvements, check my fork of your project and compare my code with yours. If you have any questions, please feel free to reply to this message.

    I wish you a great day :)

    Marked as helpful
  • Lucas 👾•104,160
    @correlucas
    Posted almost 3 years ago

    👾Hello Jacob Seymour, Congratulations on completing this challenge!

    Two more tips for you =)

    1.You made your html structure entirely with div blocks but these div doesn't any semantic meaning, for this reason is better you use a better html markup improving your code, for example for each vehicle card you use <article> instead of the <div>.

    2.I saw that for some properties you’ve used rem and for others px. In this case it is better to use only one kind of unit to have a better organization for your code. relative units as rem or em that have a better fit if you want your site more accessible between different screen sizes and devices. REM and EM does not just apply to font size, but to all sizes as well.To save your time you can code you whole page using px and then in the end use a VsCode plugin called px to rem to do the automatic conversion or use this website https://pixelsconverter.com/px-to-rem

    ✌️ I hope this helps you and happy coding!

    Marked as helpful
  • Hyron•5,870
    @hyrongennike
    Posted almost 3 years ago

    Hi @Jacwilalasey,

    Congrats on completing the challenge

    1. The reason content is overflowing outside the parent container is because you set a fix height height: 500px on mobile you just need to set it to height: auto.

    2. Remove the max-width: 70% on the p element and add the following to have 3 column in a row.

    .flex {
        display: flex;
        max-width: 800px;
        flex-wrap: nowrap;
    }
    

    @media (max-width: 768px) { .container-main.flex { flex-wrap: wrap; } }

    3. you can add the following.

    .container-main.flex {
        border-radius: 20px;
        overflow: hidden;
        padding: 0;
        height:  auto;
    }
    

    you would then have to position the card in the middle you can replace your body rule. body { margin: 1rem; min-height: 100vh; display: flex; justify-content: center; align-items: center; }

    Hope this is helpful.

    Marked as helpful
  • Atul kumar•200
    @AtulKumar0001
    Posted almost 3 years ago

    Hey there, @Jacwilalasey If I understand correctly, the answer to your first query, "How can you avoid the overflowing content," is either by reducing the font size and margin or padding you have provided inside your cards, or by simply increasing the size of your cards.

    Your second question is a little unclear to me.

    The third question's response is that you can use the styling listed below if you want to give each of your cards a different border-radius and you have to give each of your cards a different class.

    border-top-left-radius: ;

    border-top-right-radius: ;

    border-bottom-right-radius: ;

    border-bottom-left-radius: ;

    Additionally, you can employ short-hand properties.

    border-radius:(first value for top-left radius) (second value for top right radius) (third value for bottom-right radius) (fourth value for bottom-left radius);

    e.g : bottom-radius: 2px 10px 10px 20px;

    I will give you a link to learn more about border-radius. https://www.w3schools.com/cssref/css3_pr_border-radius.asp I hope this helps you.

    Marked as helpful
  • Jacob Seymour•50
    @Jacwilalasey
    Posted almost 3 years ago

    Thanks @Souicia, @hyrongennike & @AtulKumar0001

    All of your responses are extremely 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

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

Oops! 😬

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

Log in with GitHub