Giter VIP home page Giter VIP logo

fem-four-card-feature-section's Introduction

Frontend Mentor - Four card feature section solution

This is a solution to the Four card feature section challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.

Table of contents

Overview

The challenge

Users should be able to:

  • View the optimal layout for the site depending on their device's screen size

Screenshot

Mobile

Mobile Screenshot

Desktop

Desktop Screenshot

Links

My process

Built with

What I learned

  • Equal columns with flexbox. The code snippets below will create a flex container with flex items of equal width:
<div class="container">
  <div class="item item1">I am content</div>
  <div class="item item2">I am another content</div>
  <div class="item item3">I am some other content</div>
</div>
.container {
  display: flex;
  border: solid;
}

.item {
  flex-basis: 100%;
}

.item1 {
  border: solid red;
}

.item2 {
  border: solid green;
}

.item3 {
  border: solid blue;
}
  • The flex items will remain of equal width. The length of their content will not play any role in setting their width.

Continued development

Useful resources

  • Vite preview not working as expected - The context of the problem (Vue) may have been different from my context (Vanilla JavasScript) but the solution proved to be effective. Vite preview is designed to serve the production version of the website. To view the production version one must first build it, using a build script as configured for a particular environment. Trying to run the preview command in my context without first running the build command caused the problem

  • Before running the preview command first make sure the production version of the website is available in the "out dir". The out dir will have different names as per your environment. For me (Vite vanilla) the out dir is the dist folder

  • A more precise solution is offered in the following github discussion

  • Equal Columns with Flexbox - This is an amazing article which helped me finally understand, how to make flex items take up equal space in a flex container. I'd recommend it to anyone still learning this concept, as the author goes into details on how the flex items share space in a container with limited space, and also in a situation where there is plenty of space.

Author

fem-four-card-feature-section's People

Contributors

codexshell avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.