Git Product home page Git Product logo

blog-preview-card's Introduction

Frontend Mentor - Blog preview card solution

This is a solution to the Blog preview card 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:

  • See hover and focus states for all interactive elements on the page

Screenshot

Desktop

Desktop preview

Mobile

Mobile preview

Links

My process

Built with

  • Semantic HTML5 markup
  • Tailwind
  • Flexbox
  • CSS Grid

What I learned

I started adding Tailwind to the project, and configured the colors and fonts provided in the Style Guide.

Then, I created the layout using generic tags like div and span with class names, and used ChatGPT to get suggestions of semantic HTML tags to use. With a few tweaks I got the final HTML layout for the challenge.

I adapted the Learning label to be a tag list of possible topics for the blog post, so I used an ul with flow and wrap. You can check it out uncommenting the extra li in index.html

Tags preview

This challenge has this following extra challenge:

The font sizes in this project a slightly smaller in the mobile layout. Find a way to reduce font size for smaller screens without using media queries.

After some research I found the CSS clamp() function which is used for Fluid Typography. It can be used for most of the places where you can specify some kind of size. This is the syntax:

.style {
  font-size: clamp(min, ideal, max);
}

The clamp() function uses the ideal value to calculate the size, so it should be a relative value such as vw, vh, rem, %, etc. If the calculated value is less than the min value, it will use the min value. Similarly, if the calculated value is greater than the max value, it will use the max value. Therefore, both min and max should be absolute values.

Let's take a look at an example from the solution:

.lg {
  font-size: clamp(1.25rem, 5vw, 1.5rem);
}

This is used for the heading, it will have a size of 5vw, but it won't resize below 20px or greater than 24px.

Useful resources

  • MDN - MDN article with the documentation of clamp().
  • Web.dev - Web.dev article explaining how min(), max() and clamp() functions work with some helpful examples

Author

blog-preview-card's People

Contributors

fresnizky-waverley avatar

Watchers

Federico Resnizky 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.