Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 1 year ago

Blog Preview Card with hover effect

matbac85•600
@matbac85
A solution to the Blog preview card challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

I'm most proud of successfully implementing grid layouts in my project.

What challenges did you encounter, and how did you overcome them?

I couldn't trouble figure out how to decrease font size without using media queries. I've searched online and consulted documentation on units of measurement like vh, vw, etc., but haven't found a solution. Can anyone help me?

What specific areas of your project would you like help with?

I would like the solution to adjust font sizes based on screen size without using media queries. Additionally, I'd like to know how to create a smooth transition in the size of elements between screens.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Grace•32,130
    @grace-snow
    Posted over 1 year ago

    I can spot some immediate issues with the html on this I'm afraid. I hope this helps for other challenges too.

    • learn how and when to write alt text on images. There is a good post in the resources channel on discord about this. The alt you have on the main image in particular is not descriptive.
    • this is one card component. It is not a full Web page. That means it would go on a page, likely with other blog cards alongside it. A h1 is a page heading and you can't have multiple on a page. So you know the heading in this cannot be a h1, it would need to be h2.
    • it is invalid html to place units inside the width or height attribute in html. They should hold numbers only.
    • the purpose of the width and height attributes is to tell the browser what aspect ratio it should save space for while loading the image. That means if using width attribute you need to use height as well.
    • Think through the most important part of this component - it's function. How would any user ever access this blog when there is no link included in there??

    And now styling feedback:

    • never limit the height of elements that contain text, including the body. Use min height instead of height so it can extend beyond the height of the viewport when needed.
    • I recommend using flex column for centering a component in the viewport and not grid with place content center. The reason is because with that grid approach if a user has a larger text size and views the component on a smaller screen content can overflow on the left as well as on the right, which you cannot scroll to reveal. With the flexbox approach overflow would only happen on the right meaning users could scroll to reveal that content.
    • you should not have a hover style anywhere when you've not got interactive elements (see above point). Hover styles indicate interactivity.
    • you don't need to change max width in a media query
    • you should be styling mobile first. Always make mobile styles the default.
    • Media queries must be defined in rem or em not px
  • Mirjax2000•720
    @Mirjax2000
    Posted over 1 year ago

    Very prety solution.

    max-width: clamp(20.438rem, 5.352vw + 19.183rem, 24rem);

    if you have time, could you please explain how did you figure out 5.352vw + 19.183rem? I am solving that problems and still cant make it precise as i want to.

  • Arne•1,140
    @Dudeldups
    Posted over 1 year ago

    Hello! The solution looks good!

    Some small tips: When creating a website, you should always consider screen sizes from 320px and up. Your component does not have any space to the borders of the screen when viewing it at 320px.

    Also, a good use case for a <figure> with a <figcaption> is the profile picture + name 🤓

    And you don't have a <main> element in your HTML. A real website should always have a <header> and <main> element, as children of the <body>. It's probably less important on this single component challenge, but keep it in mind for future projects

    For your first question: To adjust any size (font-size, margin, padding...) you can use the clamp() function. If you already think like this, I'm sure it will become your best friend. You can also search for "clamp generator" at the search engine of your choice and it will calculate a clamp for you.

    Using anything else than rem or em for font-sizes is not a good idea. And clamps of course.

    You don't really need a transition "between screen sizes". When a user looks at a website, it is very unusual for the screen size to change. You should rather focus on having the site look good on all separate, static screen sizes 🙂

  • Adann Jacinto•790
    @DanCodeCraft
    Posted over 1 year ago

    This comment was deleted over 1 year ago

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Frontend Mentor for Teams

Frontend Mentor for Teams helps companies and schools onboard and train developers through project-based learning. Our industry-standard projects give developers hands-on experience tackling real coding problems, helping them master their craft.

If you work in a company or are a student in a coding school, feel free to share Frontend Mentor for Teams with your manager or instructor, as they may use it to help with your coding education.

Learn more

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub