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

Four Card Section using HTML/ CSS with Flexbox.

Nistor Bogdan-Ionut•50
@L0ckdawN
A solution to the Four card feature section challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


I tried to do it using flexbox, could have probably been easier with css grid, but wanted to try it with flexbox. Would love to get some feedback on this and find what I could have done different.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Szymon Rojek•4,540
    @SzymonRojek
    Posted over 4 years ago

    Hi Nistor,

    Well done :D

    I have checked your project, mainly the HTML structure by the inspector in my browser, a few tips below:

    • I started learn grid when I was confident with the flexbox;
    • the best practice is to create one repository for one project;
    • at the moment it is very hard to read your HTML structure because you didn't add a proper spacing to the elements;
    • instead of div class= "title" I'd suggest to add the header tag;
    • we can use only one the h1 tag on a page (it is very important) => in this project you can create one h1 with two spans inside (main-heading and sub-heading);
    • instead of div class="card-container" you can use the main tag to indicate the main content below the header;
    • alt text => In this project, images have an only a decorative role - that's a reason why alt text should be provided as an empty (alt="") so img can be ignored by assistive technologies, such as screen readers;
    • names of the classes are not readable and descriptive => what do you think about BEM naming convention?
    • try to do not style on tags => that's a reason why we have got a descriptive classes;
    • you have used an explicit width (container and card) => important: that's not a good practice especially that you want to use the flexbox or grid. It is essential to understand well the height and width vs min-height/max-height & min-width/max-width. You shouldn’t need to give items height unless they have a background or absolutely-positioned or floated elements within them that would not normally be accounted for in the height of an element. Experienced developers use min-height and min/max-width more than anything else. It allows elements to grow and shrink;
    • RWD: check a project in your browser by using the inspector on different devices => add text align center to the header, the cards are very narrow because of explicit width, play with margin and padding, add max-width;

    In the end, I'd recommend learning about semantic tags, headings, alt text (why they matter).

    Ps. Don't forget to upvote any comments on here that you find helpful.

    Greetings :D

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