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

Blog preview card

pure-css
LukasBFrontend•40
@LukasBFrontend
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

  • Mohammed Ibrahim•640
    @MohammedOnGit
    Posted 9 months ago

    Hello LukasBFrontend!!! Your solution for the "Blog preview card" looks good and well structured. Here are suggestions for improving your HTML code in terms of best practices, performance, and SEO:

    • Best Practices Semantic HTML:

    The <article> element is used correctly for the main content, but the <aside> tag for the date is unnecessary. Instead, use a <time> element with the datetime attribute to better represent the publication date.

    Example:

    <time id="publish-date" datetime="2023-12-21">Published 21 Dec 2023</time>
    
    • Image Path Consistency:

    Make sure your image paths are consistent (use forward slashes /), especially in the portrait image path where you're using backslashes .

    Example:

    <img id="portrait" alt="portrait" src="assets/images/image-avatar.webp">
    
    • Class and ID Naming:

    It’s best to follow consistent naming conventions. Since id is unique, reserve it for specific elements that you expect to be one of a kind on the page. You might use classes like .card-image, .author-section, .author-name for better scalability and maintainability.

    • Performance Image Optimization:

    Add loading="lazy" to images to improve page load speed by deferring offscreen images.

    Example:

    <img id="illustration" alt="weird thing" src="assets/images/illustration-article.svg" loading="lazy">
    <img id="portrait" alt="portrait" src="assets/images/image-avatar.webp" loading="lazy">
    
    • SEO Improvements Title Tag:

    Make the title more descriptive and relevant for SEO:

    Example:

    <title>HTML & CSS Foundations | Blog Preview Card Example</title>
    
    • Meta Description:

    Add a meta description to improve SEO:

    Example:

    <meta name="description" content="Learn about the foundations of HTML & CSS, the backbone of every website, defining structure, content, and presentation.">
    
    • Heading Hierarchy:

    Ensure proper heading hierarchy. You have an <h2> but no <h1>. Ideally, every page should have a single <h1> to represent the main heading.

    Example:

    <h1>HTML & CSS Foundations</h1>
    
    • Accessibility Image Alt Text:

    Improve alt text to be more descriptive of the image content.

    Example:

    <img id="illustration" alt="Illustration showing HTML and CSS" src="assets/images/illustration-article.svg" loading="lazy">
    <img id="portrait" alt="Portrait of Greg Hooper, the author" src="assets/images/image-avatar.webp" loading="lazy">
    
    • ARIA for Accessibility:

    If necessary, consider adding ARIA labels to improve accessibility on links and interactive elements.

    • Minor Code Improvements Hidden Attribution: The attribution is currently hidden using display: none. If you want to keep it hidden but still accessible for screen readers, consider using aria-hidden="true".

    Example:

    <div class="attribution" aria-hidden="true">
      Challenge by <a href="https://www.frontendmentor.io?ref=challenge" target="_blank" rel="noopener noreferrer">Frontend Mentor</a>. 
      Coded by <a href="#">Your Name Here</a>.
    </div>
    

    These changes will enhance the performance, SEO, accessibility, and code maintainability of your project. You did great. Keep it up!!!

    Marked as helpful

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