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

3-column preview card component challenge hub

materialize-css
Tomás Arregui Bellino•20
@noisyBrain
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


Hi! I have just started in the world of web development and this is my first project. I'd like to know your point of view. What should improve?

Code
Couldn’t fetch repository

Please log in to post a comment

Log in with GitHub

Community feedback

  • Grace•32,130
    @grace-snow
    Posted over 3 years ago

    Well done on the improvements. Looks much better 👏

    Here are some more suggestions, some optional, some essential

    • don't capitalise text in html, use css text transform
    • Desc needs a little margin bottom so the button and text aren't touching (viewing on mobile)
    • You don't need to change body height and width in the media query
    • Did you mean column wrap in the media query? Or did you just mean to change flex direction to column
    • Still include a fallback font for big shoulders display family
    • Line height never in px. That won't scale. Line height is usually unitless like 1.5 or can be %
    • Font size never in px. That won't scale. Use rem
    • Did you mean to make the links display flex? That stretches them the full width available. Did you actually mean to use inline-block or inline-flex perhaps?
    • No need to but background color on a paragraph, it's transparent by default
    • Don't forget to add obvious focus-visible styles to every interactive element. This is essential to make it clear for keyboard users where is focused on a page

    In html

    • sections add no additional semantics here, divs would be fine
    • Header is the wrong element to use. I think you mean to use h2?
    • if you consider icons to be decorative, their alt attribute should be empty. If you think they offer meaningful content, the alt description should describe them like any written phrase, not hyphenated text for the computer
    Marked as helpful
  • David Osorio•560
    @osoriodev
    Posted over 3 years ago

    Hello 👋

    A couple of things that I can recommend you

    • Try not to use <br> tags, since these modify the document flow and that must be done from the CSS. If you want to create a spacing, you can use the margin properties.
    • Use more semantic HTML, for example Sedans, Suv and Luxury are titles, in this case you can use HTML title tags, the span is for text that has no relevance.

    Overall, your project is a good start. Keep coding 👨‍💻

    Marked as helpful
  • Grace•32,130
    @grace-snow
    Posted over 3 years ago

    Hi Thomás

    It's important you don't move on and spend some time refactoring this project. It will be essential for learning.

    Here are notes I made in browser. I recommend you go through them one by one watching the results. It will look broken at times as you make the changes, but as you do more they will fix again.

    body {
      /* position: relative; */
      /* height: 100vh; */
      /* width: 100vw; */
      min-height: 100vh;
      padding: 1rem;
      note: min-height allows content to grow. Padding stops the content hitting screen edges. No need for position relative.;
    }
    
    .mainContainer {
      /* position: relative; */
      /* justify-content: center; */
      /* align-items: center; */
      max-width: 58rem; // or similar - use pixels for now if you like
      border-radius: 0.75rem;
      overflow: hidden;
      note: border-radius and overflow hidden on this means you don't have to set it on individual corners;;
      note: this should be a main element (a landmark);
    
    }
    
    .mainContainer div {
      /* width: 290px; */
      /* height: 460px; */
      note: again, use a reusable card class on all 3 cards;
    }
    
    * {
      /* font-size: 15px; */
      font-size: 0.9375rem;
      note: NEVER have font size in px;
    }
    
    .sedanContainer {
      /* position: relative; */
      /* border-top-left-radius: 5px; */
      /* border-bottom-left-radius: 5px; */
    }
    
    div img {
      /* display: flex; */
      /* position: relative; */
      /* background-color: inherit; */
    }
    
    span {
      /* font-size: 36px; */
      font-size: 2.5rem;
      note: Must be a heading element;
    }
    
    #sedan-button {
      note: Never style on IDs;
    }
    
    .button {
      /* position: relative; */
      /* border-radius: 50px; */
      /* padding: 13px 30px; */
      border-radius: 2.5em;
      padding: 1em 2em;
      margin-bottom: 0;
      margin-top: auto;
      note: because this is a flex column, margin top auto will push it to the bottom of the cards.;
      note: These would trigger navigation so must be anchor tag elements, not button elements;
    }
    
    @media (max-width: 375px) {
        note: media query needs to start as soon as there isn't room for the larger screen layout. 375px is way too late to change as I shrink the screen down.;
    }
    
    .mainContainer > * {
      note: this would be better done with the same class on all three cards instead of a very specific css selector like this;
      display: flex;
      flex-direction: column;
      align-items: flex-start;
    }
    
    .mainContainer div > * {
      // set everything inside the cards to have some margin in one direction. Only the btn wont need it
      margin-bottom: 1.5rem;
    }
    
    .mainContainer > * {
      note: Delete all the brs;
    }
    
    

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.

Frontend Mentor for Teams

Frontend Mentor for Teams helps companies and schools onboard and train developers through project-based learning. Our industry-standard projects give developers hands-on experience tackling real coding problems, helping them master their craft.

If you work in a company or are a student in a coding school, feel free to share Frontend Mentor for Teams with your manager or instructor, as they may use it to help with your coding education.

Learn more

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

Frontend Mentor for Teams

Frontend Mentor for Teams helps companies and schools onboard and train developers through project-based learning. Our industry-standard projects give developers hands-on experience tackling real coding problems, helping them master their craft.

If you work in a company or are a student in a coding school, feel free to share Frontend Mentor for Teams with your manager or instructor, as they may use it to help with your coding education.

Learn more

Oops! 😬

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

Log in with GitHub