Skip to content

John-Davidson-8/fem-product-preview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Frontend Mentor - Product preview card component solution

This is a solution to the Product preview card component challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.

Table of contents

Overview

The overview is to build a product preview card component with html and css.

Screenshot

mobile image of perfume bottle

desktop image of perfume bottle

Links

My process

My process in this my first Frontend Mentor challenge was to follow Kevin Powell as he created this component, pushed it to Github and deployed on Netlify -- https://www.youtube.com/watch?v=B2WL6KkqhLQ. My process included using the provided Figma sketches.

Built with

  • Semantic HTML5 markup
  • CSS custom properties
  • Flexbox
  • CSS Grid
  • Mobile-first workflow

What I learned

The reason I watched Kevin was not so much to help me with the general coding of the component but to become familiar with the following:

  • process of initialising the repo and deploying to Github and Netlify.
  • I learned a variety coding practices including setting up global css for a small project.
  • Also, the picture tag and source tag in html and how to put a media query within was a revelation to me! I have copied and pasted the code directly below in the html section.
  • Kevin also showed how to set "visually hidden" information for accessability. In this project two prices sit next to each other, the previous price has been scored out, and the new discounted price is larger and a different color. A visually impaired person would only hear the two prices one after the other from the software reading the component. We inserted "current price," and "original price" to be read by screen reader, but hidden visually.
<picture class="product-img">
  <source
    srcset="images/image-product-desktop.jpg"
    media="(min-width: 600px)"
  />
  <img src="./images/image-product-mobile.jpg" alt="perfume image" />
</picture>
.visually-hidden:not(:focus):not(:active) {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}
<div class="flex-group">
  <p class="product-price">
    <span class="visually-hidden">Current price:</span>
    $149.99
  </p>
  <p class="product-original-price">
    <span class="visually-hidden">Original price</span>
    <s>$169.99</s>
  </p>
</div>

Continued Development

  • CSS Flexbox and CSS Grid need to be learned before moving on to Tailwind or any other library.
  • Continue using terminal, Github and Netlify until it becomes second nature.
  • Next challenge is to create a Frontend Mentor project without following a tutor.
  • Continue to learn how to write README's. This not only helps other folk understand my code better, but also helps me understand my code better as it is a fantastic means of self reflection. Writing about coding is a wonderfull way to learn how to communicate coherently within a team discutssing code.

Useful resources - Example resource 1

About

A small Frontend Mentor project using Flexbox. Learned: media query.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published