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

Article Preview Component

bem
denise•530
@moncadad
A solution to the Article preview component 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?

Most proud my use of class list toggling along with the styling it triggered. Took me a bit working out the kinks, overall I feel like I did a good job.

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

Big challenge was getting the share bubble to position where I wanted it to due to added spacing that I wasn't 100% sure off. I used negative values on any added margin. I'm not sure if that's the norm, but it got the job done. I'd love to hear about any tips and tricks y'all may have used.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Adesh Katiya•420
    @adeysh
    Posted 4 months ago

    Hey there! I see you did a good job replicating the design with good html structure. However here's what I would suggest 😇 (I have provided you feedback just scrolling through your code sequentially top-down):

    • I think you have added the scipt link for font-awesome icons 2 times by accident. You can remove it.

    • wrap the card in a <article> tag rather than <main> because it can be used independently anywhere.

    • Use <picture> tag to change the picture used in the card at different screen sizes. I think you have used a single picture so you can style it with object-position property for mobile screens. Look at the mobile designs closely you will find that they are kind of cropped from top and bottom.

    • Also you have used an img tag inside your card__img div but you have given a background image to your card__img div which is redundant and not useful. Use one way to render your image and be consistent.

    • For the other end of the card i don't think aside is semantically correct to be used here. It's just the content for the card that is typically used in any card layout so rather you can just wrap it in a div with card__content class or a section to be more semantic.

    • Inside your <article> since you have used <wrapper> to style it with padding you can remove and put styles for it rather directly in the article tag.

    • Since you're using bem naming convention, try to use bem classes for your components with classes and use only those classes to style it. Also try to divide them mindfully looking for any repeating styles that you can create a class which can act as utility like font-styles and flex-box styles.

    • Never use footer inside the main tag. Since this is a card component the footer is not particularly required as such but even if you want to use it you can do inside your article tag and with a specifying class like card__footer to show that this footer belongs only to the card only.

    • Inside your footer section, the card author and date could be wrapped inside a more meaning-full class like card__profile or card__profile-container. Also they are more like block elements rather than sections since they only have a single line of text.

    • The share section and share button is good as is. Good job

    • On click of the share button the card author text and date get shifted somewhat to the right you can fix it.

    • Try to be consistent with font-sizes preferable using rem units in your css.

    • Use your variables you have defined for font-sizes.

    • Rather than using separate class for flex-styles or disply:none you can create a separate class and add it to whatever tag you want.

    This may seem a very verbose feedback but try to refactor your code and make it DRY. Otherwise that's a really good looking card 🤩🤞

    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