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

A did a mobile first design, used flex-box for the layouts.

NaN-DOM Alfred•20
@domkoder
A solution to the Four card feature section challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Please, guys, you can go through my code and check out my work. Please tell me what am doing wrong or a better way of doing it.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • P
    Nitya Gulati•665
    @nityagulati
    Posted over 5 years ago

    Hi Scotrolex, the site looks great on both mobile and desktop and the code is clean. Great job on doing mobile-first design! I personally find it to be a better workflow.

    Some pointers to clean up the code further:

    1. There's a typo in the code below, #second-dv should be #second-div.
    • current .container #second-dv .box h3 { font-size: 20px; letter-spacing: 1px; }

    • fixed .container #second-div .box h3 { font-size: 20px; letter-spacing: 1px; }

    1. Move the .attribution styles from index.html to your stylesheet styles.css instead. All styles should be in the external stylesheet.

      .attribution { font-size: 11px; text-align: center; }

      .attribution a { color: hsl(228, 45%, 44%); }

    2. Try to use class to style the elements wherever you can instead of ID. It's good practice to use classes for styling and only use ID when needed. This helps in reducing your code because you can reuse the class if more than one element require the same style, now or at any time in the future. This helps to keep your code maintainable and scalable.

    • add another class to each .<div id="box"> such as .box-1, .box-2, and so on. ` <div id="second-div"> <div id="box-1" class="box box-1"> <h3>Supervisor</h3> <p>Monitors activity to identify project roadblocks</p> <img src="images/icon-supervisor.svg" alt="Supervisor" /> <div class="clear"></div> </div>

        <div class="test">
          <div id="box-2" class="box box-2">
            <h3>Team Builder</h3>
            <p>Scans our talent network to create the optimal team for your project</p>
            <img src="images/icon-team-builder.svg" alt="Team Builder" />
            <div class="clear"></div>
          </div>`
      
    • use .box class for styles that need to be reused

    .box { border-radius: 10px; margin-bottom: 30px; padding: 0 20px 0 20px; box-shadow: -2px 18px 20px 3px hsl(0, 0%, 91%); }

    • use .box-1, .box-2, and so on for individual styles

    .box-1 { border-top: 5px solid hsl(180, 62%, 55%); }

    .box-2 { border-top: 5px solid hsl(0, 78%, 62%); }

    1. Add class names to all other elements that require styling. Your selectors are way too specific at the moment, which is not needed in most cases. You can simply use the class names to style the elements.
    • add classes to each element such as .intro-title, .intro-desc etc. <div class="container"> <div id="first-div"> <h1 class="intro-title"> <span>Reliable, efficient delivery</span> <br /> Powered by Technology </h1> <p class="intro-desc"> Our Artificial Intelligence powered tools use millions of project data... </p> </div>

    • use .intro-title to style the h1 element instead of .container #first-div h1

    .intro-title { font-size: 24px; font-weight: 600; }

    you can also read up on css selectors and selector specificity to learn more about it

    1. Use intuitive names for classes and IDs. Your current names such as #first-div, .container etc are fine for small webpages such as these but it's always a good practice to choose names that are readable, intuitive and self-explanatory. This not only helps with debugging but also when collaborating with others or when you come back to a project after a while and have to make modifications.
    • maybe something like this <div class="main-container"> <div id="intro" class="intro-section"> <h1 class="intro-title"> <span class="intro-title__span>Reliable, efficient delivery</span> <br /> Powered by Technology </h1> <p class="intro-desc"> Our Artificial Intelligence powered tools use millions of project data... </p> </div>
    1. Try playing around with relative units instead of 'px', especially for font-sizes, margins and paddings, etc, such as font-size: 1.5rem; and margin: 5%;. This makes the code more responsive because things can scale up or down according to another value such as screen size or the parent element.

    Few things to consider next and read up on

    • Practice writing code using HTML5 semantic tags. This will also help in laying out your HTML structure better.
    • Look up CSS naming conventions, such as BEM, to help you in naming your elements. This is a good quick read - CSS naming conventions that will save you hours of debugging

    And of course, practice, practice, practice! Happy Coding :)

  • Matt Studdert•13,611
    @mattstuddert
    Posted over 5 years ago

    Awesome work on this challenge, Nandom! @nityagulati has already given you some incredible feedback, so I'll just say keep up the great work. Take your learnings from each project into the next and your coding ability will really skyrocket! 👍

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

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