Frontend Challenge #10, Four card feature
Tags: devjournal, webdev, codenewbie, challenge
Published: 2021-12-22 01:35:15

Follow me as I briefly describe my coding journey to build the four card feature from [Frontend Mentors](https://www.frontendmentor.io/home). 

This is my #10 frontend focus side project in two months. This short journey have showed me the accumulative effort of constant learning. This project took several hours off and on throughout a 24 hour time period instead of the usually several days. 

The goal is to build this:

![Preview design to be built](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o97vepy0miq2t0q0k8rq.jpg)

## Step 1: Setup
I’m a big fan of the software [GitKraken](https://www.gitkraken.com/). It’s a quick intuitive visual software for making Git commands for a project. My first step in each project is to create a GitHub repository and load the given starter files from Frontend Mentor.

It may or may not help someone but my code editor of choice is [Visual Studio Code](https://code.visualstudio.com/). A code editor is a fancy text editor that is specialized for writing software. It’s easy to use and I love customizing it to make coding more enjoyable. A must-have extension is [“Live Server”](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer). This extension runs a local server that displays your web page in the browser and constantly updates it as you code. This eliminates the time wasting process of manually refreshing the web page to see changes.

Another key setup action is updating the project with all recommended styles from the style guide. This includes creating CSS Variables for colors and searching Google fonts for required font families.


![Code that show CSS Variables](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/flemq36a7n0mvvsy2vkp.PNG)

## Step 2: Find Key Problems
The main hurdle I saw were four card components in a three column pattern. The columns needed to be horizontally aligned in a row for desktop responsive layout but vertically aligned for a mobile responsive layout. 

![Mobile vs Desktop design responsiveness](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rdzm2cxg2ueqt3t03s9k.png)

## Step 3: Create a Basic Layout
I’m learning it’s easier to start a web page’s project by laying out the basic HTML elements and content. The trick is no styles. Just focus on semantics.

One of my goals is to practice more meaningful class names. With this in mind, I added BEM inspired CSS class names with no styling included so I can focus on the naming.

![Code showing the layout](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ujt4hbpls01uq1awwvi.PNG)


![Screen shot of the UI with no styling](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/94ocrupcgp5oniy60hq4.PNG)

## Step 4: Visually Style the Header
I like to style from the top down or section by section. In this case, I’m starting with the header. 

![Screen shot of the UI with a focus on  the header](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2667rc0q9hl5dkbr386y.PNG)

## Step 5: Visually Style the Feature Cards
A tool I used to help quickly make the drop shadow was [CSSGenerator](https://cssgenerator.org/box-shadow-css-generator.html). 


![Screen shot of UI with a focus on the cards](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dblnypi8ooflp52xpcfm.PNG) 

## Step 6: Slowly Work in Desktop Layout Styles
This was the longest process in that I slowly added styles to make the product design responsive for desktop while maintaining the mobile. Over time, I found issues I’ve created like:

1. The card’s width was either too wide or short based on screen size. The solution was to use max-width CSS for the styles and remove lots of increasing media queries with margin styles.
2. The gap between columns was too wide or the cards were touching each other. The solution was to depend less on setting margins and more on using Flexbox to handle spacing.
3. In mobile layouts with higher widths, the feature cards were way too big. Again, the solution was max-width and Flexbox.

![GIF of the UI design responsiveness](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jdnvk6tj2qkhkt750w13.gif)

## Final Outcome

![Final UI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bs3g7w08oj5fm56efzl2.PNG)
You can find the completed code [here](https://github.com/jcsmileyjr/Four-Card-Feature) and play with site [here](https://jcsmileyjr.github.io/Four-Card-Feature/).

## Resources used

1. [GitKraken](https://www.gitkraken.com/)
2. [Visual Studio Code](https://code.visualstudio.com/)
3. [VS Code Live Server Extension](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer)
4. [GitHub](https://github.com/)
5. [https://cssgenerator.org/box-shadow-css-generator.html](https://cssgenerator.org/box-shadow-css-generator.html).

### Thank you for reading, let's connect:
Obviously, this isn’t a perfect solution. If you have any advice or criticism please leave a comment or send it privately via a DM.

Thank you for reading my learning journey and if you have tips, please DM me on [Twitter](https://twitter.com/JCSmiley4) or [LinkedIn](https://www.linkedin.com/in/jcsmileyjr/).