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

Build a blog page using semantic HTML, CSS, Flexbox and Aria labels

accessibility
P
markobrien7•60
@markobrien7
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 would probably look at using SASS as the applications in my work use that.

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

I wanted to make the blog header the most important item on the page for a screen reader so I made it the h1 and reordered the list with flexbox order. But at the end I noticed this was to be an anchor tag, so I wasn't sure how best to handle that. In the end I went with a h1 inside and anchor tag.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • AlejandroIMP•190
    @AlejandroIMP
    Posted 4 months ago

    Well done!

    I have some feedback, I hope you find them useful

    Areas for Improvement:

    Heading Hierarchy:

    • The <h2> tag is used for the date, which might not be semantically correct. Consider using a <p> tag or a <time> element instead.
    • Example:
      <p class="blog-article-date">Published <time datetime="2023-12-21">21 Dec 2023</time></p>
      

    Unnecessary <div> for Tag:

    • The <div> used for the tag (<div class="blog-article-tag">Learning</div>) could be replaced with a more semantic element like <span> or <p>.
    • Example:
      <span class="blog-article-tag">Learning</span>
      

    Footer Link:

    • The link in the footer for "Coded by" is missing a proper URL. Consider adding a valid URL or removing the link if it’s not needed.
    • Example:
      <span>Coded by <a href="https://github.com/yourusername" target="_blank">Mark O'Brien</a></span>
      

    Overall, the code is well-structured, Bravo!

    Marked as helpful
  • Abdulrahmon Ogunwale•100
    @moyinoluwa001
    Posted 4 months ago

    ✅ Strengths: Clean Structure: The code is clean and easy to read. The use of flexbox for centering the card and managing layout works well and ensures a balanced design.

    Responsive Design: The solution includes responsive breakpoints (@media queries) that adjust the layout for tablets and smaller screens effectively. The scaling of text sizes, padding, and image adjustments are thoughtful and improve usability on different devices.

    Consistent Styling: The consistent color scheme and use of shadows give the card a polished look. The hover effects on the links (if added) would enhance interactivity. Accessibility (A11y): Missing alt Attributes: The SVG illustration and author image should have descriptive alt text for screen readers. For decorative images, use alt="" to allow screen readers to skip them. Improved Text Contrast: The gray text (#555) might not provide sufficient contrast on certain screens. Consider using a darker shade to enhance readability. Keyboard Navigation: Ensure interactive elements (like the title or links) are focusable using the tab key, improving navigation for keyboard users.

    Consistency: The card container padding is quite large (40px), which reduces usable space on small screens. Reducing padding slightly can optimize space without compromising aesthetics. The author’s name is wrapped in <sanp> instead of <span>, which is likely a typo. This should be corrected for proper HTML validation. SVG Optimization:

    The current SVG code is quite large. Consider simplifying or compressing the SVG using tools like SVGOMG to reduce file size and improve load times. 📱 Responsive Design Notes: The card scales down well, but on very small screens (under 320px), the text may feel cramped. Adjusting the font sizes slightly smaller in the last media query can improve the layout. Consider adding some margin around the card container on small screens to prevent the content from touching the edges of the viewport.

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

Oops! 😬

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

Log in with GitHub