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

Blog preview card

Cheikh Sy•30
@chkhs
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 finish this project without loking at YouTube tutorial.

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

The challenges that I encountered were css widths, heights. As I overcame them, I began to understand it more.

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

The areas that I would like help with is css widths, heights and learning how to structure your project in HTML.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Dylan Molthu•70
    @dmolthu
    Posted over 1 year ago

    Hello, I thought you did a great job on this project, it looks pretty much identical to the sample and it's just about the same size too.

    I noticed in your code that you made the learning button interactable by hovering over it and being able to click it which I thought was a nice addition.

    Code looks good too overall great job.

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

    Hi, here is some feedback as requested, I hope it helps.

    1. All content should be contained within landmarks. Ever page at least needs a main landmark so I recommend you use that instead of where you have used section.
    2. Img elements must always have an alt attribute. It is a serious accessibility failure to leave that off. Images that are meaningful content must have a proper alt description or images that are purely decorative can have the alt left blank. There is a good post in the resources channel on discord about how to write good alt text.
    3. You don't need all these extra divs wrapping tbe child elements of the card like the image, learning tag, and text content. As a general rule try to keep the html as simple and minimal as possible.
    4. What is it you envisage clicking on the "learning" button would do? I am.veru surprised you've made that into a button as it is unusual for tags in a card design like this to be clickable. It would help if you explained your thinking behind that choice.
    5. The published date is definitely not a heading element. It's just a paragraph, and can optionally include the time element for the date part. It's very important to use headings appropriately and in the correct order.
    6. When building single components like this, think about the context of where they would be used in a real website. This kind of card is likely to be in a grid or list with other blog cards or in a sidebar on another page. It is extremely unlikely this card would ever act as a page title. That tells you the heading must not be a h1. A h2 would be a more appropriate heading level.
    7. Similarly, the author name is definitely not a heading either, it's just a paragraph. Note how it has no content underneath it — it's not acting as a heading for any content. I can't stress enough how important headings are for an accessible site. They are some of the most important elements for communicating content structure and for navigation. It's very important to use them only in the right places and in the correct order.
    8. Get into the habit of including a full modern css reset at the start of the styles in every project. Andy Bell or Josh Comeau both have good ones you can look up and use.
    9. The picture element must not have an explicit width. That is what is breaking this solution for me and causing it to overflow my screen on the sides. Let it be width 100%. (It really doesn't need to be flex either).
    10. The card should have padding on all sides. The child elements within it should.only need vertical margins and no padding. Make sure you understand the difference between padding and margin.
    11. ⚠️ Font size must never be in px. This is extremely important.
    12. You will also never want to use em for font size. That can lead to really awful bugs because em font sizes compound. You only want to use the em unit in specific instances where you need a property to scale with the current elements font size. For example, padding on a button or letter spacing would both be good use cases for the em unit.
    13. To make the whole card clickable (as is the design intention) make the card component position relative, then add a pseudo element to the blog title anchor. Make that pseudo cover the whole card and it will all become clickable.

    Once you've remedied this challenge, go back through previous ones and apply the learnings before moving on to anything new. Good luck.

  • Herve•40
    @HerveWabo
    Posted over 1 year ago

    Great job. nice additions on the H1 link and the button. why did you choose button over an anchor for the blog category?

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

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