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

Usei flexbox

Vinicius•20
@vinicim002
A solution to the Blog preview card challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)
Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • P
    Sabine•80
    @SabineEmden
    Posted 10 months ago

    Hi there! 👋 Good job on completing the challenge.

    All in all, you code looks pretty good. You could simplify it by using fewer HTML elements and default styling in place of CSS flexbox for the card component. Here are some points you may want to consider:

    HTML

    • The image on top of the card is purely decorative. The card looks better with it there, but it doesn’t add anything to the content. Decorative images should have an empty alt attribute (alt=””).
    • You wrapped both images in a <figure> element. I definitely wouldn’t use <figure> for a decorative image. I also wouldn’t use it for the author avatar. In my opinion, an <img> element for the avatar and a <p> element for the author’s name, wrapped in a <div> for styling is all you need. If you want to use <figure>, I would use <figcaption> for the author’s name instead of <p>.
    • You have two <section> elements and a <footer> on the card. I recommend removing all three. You don’t need them for styling, and in my opinion they don’t have enough content for a section or a footer.
    • You used a heading element with class=“box-learning”. In my opinion, this is not a heading. I would replace it with a <p> element as a more generic block-level text element.
    • You used <br> elements in the paragraph with the description of the blog post. Only use the line break element if the division of lines is significant, for example in a poem or an address.
    • Don’t forget to customize the attribution at the bottom of the page. I would replace <div class=“attribution”> with a <footer> element, replace Your Name Here with your name, and add a link either to your personal website or your Frontend Mentor profile.

    CSS

    • I like your use of CSS custom properties and how you used rem and px. Well done!
    • You used two font families, Figtree and Open Sans. I’m pretty the design uses only Figtree.
    • You used the <main> element for the card component and centered it horizontally with margin: 15rem auto. I would wrap the card in a <div> inside <main> and use flexbox to center it.
    • You gave the card component width and height in rem. All it needs is max-width. Setting height for a container with text is generally not a good idea.
    • Add some padding to the card component.
    • You don’t need display: flex on the card component itself, only on the element that wraps the avatar and the name.
    • You can use width: fit-content for .box-learning, then you don’t need text-align: center.
    • Move the CSS styling for the attribution from index.html to your style sheet.
    • I’m curious why you used @charset "UTF-8” at the top of your stylesheet. I have never seen this before.

    I hope this helps. Let me know if you have any questions.

    Happy coding! 😎

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 1st-party linked stylesheets, and styles within <style> tags.

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.

Oops! 😬

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

Log in with GitHub