GithubHelp home page GithubHelp logo

front-end-challenge-1's Introduction

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 challenge

Users should be able to:

  • View the optimal layout depending on their device's screen size
  • See hover and focus states for interactive elements

Links

My process

Built with

  • Semantic HTML5 markup (I did my best :-))
  • CSS custom properties
  • Flexbox
  • CSS Grid
  • Mobile-first workflow

What I learned

In this project i learned how to use CSS grid to make a simple layout that adapts itself based on the screen size. I also learned how to use the HTML picture element to display responsive images based on the resolution or on the screen size. I thought we need to use CSS but HTML picture element did the job pretty well. It's something like this.

<picture>
  <source media=(max-width: 640px) srcset="url_to_your_image"/>
  <img src="url_to_your_image"/> <!-- Very important ! Otherwise the image won't render -->
</picture>

With this we basically tell the browser to load the image based on the size of the screen. In this case For screen sizes under 640px it's the default image (in the <img/> tag) that will be displayed.

Useful resources

  • Responsive images - This helped me for displaying the right image based on the screen size. You can learn more on responsive images by following the link.

Acknowledgments

One of my inspiration when it comes to CSS it's Kevin Powell. I learned a lot by watching his videos and using his tips. Maybe you will too, check his Youtube channel.

front-end-challenge-1's People

Contributors

7h3xxx 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.