Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 12 months ago

Blog-preview-card-main using HTML and CSS

P
Hector Ramirez•450
@hectorlil48
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 proud that I was able to make it responsive. And finally getting to use the calc() function, makes me understand it better.

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

I don't have much experience making a website responsive. I got to work with media queries and use the CSS calc() function to make my fonts responsive.

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

All feedback is welcomed!

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

  • P
    Jeff Guleserian•500
    @jguleserian
    Posted 11 months ago

    Greetings, Hector!

    Congratulations on a job well done! I enjoyed seeing how you solved some of the same issues I had when doing this project. I enjoyed going through your solution and seeing your strategy.

    I did have a couple of questions, however. These have to do with your use of calc(). You wrote, for example:

    .content h1 {
      font-size: calc(20px + (24 - 20) * ((100vw - 320px) / (1280 - 320)));
      font-weight: 800;
    }
    

    First, I wondered why you didn't go ahead and put the number 4 instead of (24 - 20) since these would always come out to be the same and parentheses have precedence over operands. The same goes for (1280 - 320). The second question was where you got the number 1280. I can see the relevance of the other numbers, but that one lost me.

    ##Observations##

    One observation I had was that your box shadow seemed larger than the model's. As I looked into your code, I saw this:

      -webkit-box-shadow: 12px 12px 0px 0px rgba(0, 0, 0, 1);
      -moz-box-shadow: 12px 12px 0px 0px rgba(0, 0, 0, 1);
      box-shadow: 12px 12px 0px 0px rgba(0, 0, 0, 1);
    

    I think all you needed was the box-shadow, and not the additional "webkit" and "moz" versions. Did you have a specific purpose in using those? If not, the redundancy may have thrown things off.

    Another thing I noticed was that the height of the mobile version (at 375px) was not the same as the model. As I looked closer, I could see that it was the size of the image that was the problem. The picture dimensions should be smaller, but the image should crop a little on the right and bottom. This has thrown off what would otherwise be a perfect alignment.

    Finally, I noticed that to center your blog card, you made the <body> a flex container. While this works, and solves the issue with how to center the pesky attribution element at the end, it made your design just slightly on the Frontend Mentor comparison "solution vs. design." This is, of course, non-consequential and means nothing except that at superficial glance it looks like the proportions are off, which they are not. It's just that your design set a tad higher in the preview.

    Anyway, cudos to you, for creating such awesome proportions and spacing and the use of calc(). I started to use calc(), but was too lazy to think through all the math like you did. I used clamp() instead. nevertheless, you really thought through this one and it looks great.

    I hope my comments are helpful. Take them or leave them. I am learning just like you.

    Best regards and happy coding!

    Jeff

    Marked as helpful
  • P
    Hector Ramirez•450
    @hectorlil48
    Posted 11 months ago

    Thank you for the comment. When I was doing the project, I looked up how to make my font sizes more responsive and that's what I found. But from doing more projects I discovered that just using media queries to change the font will be easier and confusing. For the box shadow, I use this generator online and try to make it look as close as possible, they provide it with the -webkit and the -moz. I will look into my project's height but have begun using clamp and media queries to make my projects more responsive.

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
Frontend Mentor logo

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.

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