Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 3 years ago

mobile first, pure html and css

Wang•60
@effycoco
A solution to the Article preview component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Though it's relatively easy, it costs me one day (6h+) to complete this challenge.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Raymart Pamplona•16,040
    @pikapikamart
    Posted over 3 years ago

    Hey, really nice work on this one. The desktop layout looks really great, the site is responsive and the mobile state looks really great as well.

    Here are some suggestions for the site:

    • Don't use position: absolute a very large element. If you inspect your layout, hover on either html or body tag, you will notice that it has no height since its element is being absolute. Since you are just using this to center the layout, it would be much better to do it this way. But first, remove these stylings on the main and footer:
    position
    top
    left
    transform
    

    Then on the body tag, just add:

    align-items: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
    

    You add a gap as well if you want to have a spacing between the card and the footer.

    • You don't need the section on it though since you already have a article tag inside it. It will just create an extra landmark navigation using screen-reader, the article is enough on this one.
    • The person's img could just use the person's name and you can remove the avatar word.
    • When wrapping up a text-content, make sure that it is inside a meaningful element like p tag or heading tag and not using like div, span to wrap the text.
    • For the share-toggle, you should have not set the display: none on the button. Remember that interactive component needs to use interactive element. By using only a div as toggle, you are excluding lots of user because only mouse could interact with it. Style the button to look like that toggle.
    • If you used button, it should have either aria-label attribute or sr-only text inside it which defines what the button does. It could be something like aria-label="share on social media dropdown".
    • The button as well should have a default of aria-expanded="false" attribute which will be set to true if the user toggles the button and vice-versa.
    • The img inside the toggle is only a decorative image. Decorative images should be hidden for screen-reader at all times by using alt="" and aria-hidden="true" to the img tag or only aria-hidden="true" if you are using svg instead of img tag.
    • As I suggested the usage of flexbox to center the layout, the social-media-dropdown is out of place. For this one, I would prefer to make a container, a relative container, which will nest the button toggle and the dropdown so that it will be properly controlled.
    • Those social-media links could be inside a ul element since those are "list" of links.
    • Each a tag that wraps the social-media icon should have either aria-label attribute or sr-only text inside it, defining where the link would take them. For example, you should use facebook as the value if the link would take the user to facebook.
    • Social-media image should be hidden since it is only a decorative image so use alt="" and aria-hidden="true".

    Aside from those, great job again on this one.

    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