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

Blog preview card

accessibility, pure-css
Dotzin•80
@Dotzin
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

  • lucielub•120
    @LucieLuB
    Posted 12 months ago

    Your HTML structure and the SVG implementation look good overall, but there are a few points of improvement, best practices, and feedback to enhance your code's readability, maintainability, and performance.

    1. Naming Consistency and Readability: Use consistent class naming throughout your code. You're mixing English and Portuguese (conteiner, aprendendo, publicacao, titulo, etc.). It's better to stick to one language for class names to maintain consistency and avoid confusion.

    For example, rename:

    <div class="conteiner"> <!-- Use container instead --> <div class="aprendendo"> <!-- Use learning instead --> <div class="publicacao"> <!-- Use publication instead --> Consider using more descriptive and meaningful class names in English if that's your project's language.
    1. Semantic HTML: You are using div elements for everything, including the title and description, which reduces the semantic meaning of your HTML. To improve this, use semantic HTML tags where appropriate:

    Replace the div for the title with a header or h1. Replace the description section with a p tag for paragraph content. Example:

    <header class="title"><h1>HTML & CSS foundations</h1></header> <p class="description">These languages are the backbone of every website...</p>
    1. Accessibility: Alt attributes: Always add meaningful alt text to images for accessibility. For the avatar image, you should add a proper description instead of leaving the alt attribute empty.
    <img src="assets/images/image-avatar.webp" alt="Picture of Greg Hooper" />

    SVG accessibility: For your SVG graphic, consider adding aria-hidden="true" if it’s decorative and doesn't provide important information for users with screen readers. If it conveys information, add a proper title inside the <svg> tag.

    Example:

    <svg aria-hidden="true" ...>

    1. CSS Inline Styles: You have inline styles for the .attribution class. It’s generally a good practice to separate styles from HTML. Move these styles into the style.css file for better separation of concerns.

    Example:

    .attribution { font-size: 11px; text-align: center; }

    .attribution a { color: hsl(228, 45%, 44%); }

    1. Optimization and Performance: Reduce SVG complexity: The SVG you are using is quite complex. If it’s decorative or not essential for understanding the page, you might want to consider optimizing it using tools like SVGOMG to reduce the size and complexity.

    Avoid empty alt attributes unless an image is purely decorative.

    1. Responsiveness: You already have the meta viewport tag, which is great for ensuring responsiveness, but you might need to check if your layout is responsive across different screen sizes. Consider adding media queries in your CSS to handle small screens and ensure elements like text, images, and SVGs are scaled appropriately.

    2. Minor Corrections: Fix spelling issues like conteiner (should be container), and make sure to follow proper naming conventions.

    Final Feedback:

    Good points: The use of SVG is nice for scaling and quality, the meta tags are properly included, and the structure of the document is organized.

    Areas to improve: Focus on using semantic HTML, improving accessibility, ensuring naming consistency, and separating styles from the HTML file. These changes will make the code cleaner, easier to maintain, and more scalable.

    With these improvements, your code will be more efficient, accessible, and maintainable.

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

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