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

Article preview component - No framework - Only CSS and Vanilla JS

P
Thomas Dimnet•250
@tdimnet
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?

Hi folks, Thanks for reading this!

I managed to use the same element for the tooltip on mobile and desktop. I wasn't really sure at first that I could to that but it worked. Quitte happy with that :). It uses the same JavaScript and CSS code.

Next time, I want to be better with ARIA attributes. I know that my code is accessible but I want to do a better job with that.

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

Not many challenges. The only one I have in mind is related to CSS readability. I wrote some nested CSS, which I do like, but some parts could have maybe been better. I am thinking about the tooltip element on desktop.

What specific areas of your project would you like help with?

Mostly the HTML and CSS. I am okay with the JS part.

Have a nice day, Tom.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • joacomenda•170
    @joacomenda
    Posted about 1 year ago

    There are some improvments that you can do:

    • In your footer, I would recommend creating 2 divs, one div will contain the image of the author of the article, then you create another div that contains the author and the date of publish. In the second div, you would put the button of the article (you can create a button element, then you copy and paste the share svg that frontend mentor gives you and then you put some text in the button, then you style it to have 0 font-size so screen readers can undestand that the button is used to share content). Now, you style the div that contains the 2 divs, use display:flex, align-items:center and justify-content:space between. With this, your footer is perfectly aligned and your button is in the far left of the article.

    • When users display your article in an ipad, the layout goes far down, be careful with that. I would recommend you to investigate about how can you center content perfectly using grid or flexbox. In my body, I display:flex, justify-content:center (to put it in the center of the page in the X axis) and align-items:center(to align it to the center in the Y axis). This only works if you put a height of your body to 100vh and set a width to your wrapper.

    *I would also sugest using max-width in order to avoid an excesive stretching of your article

    I hope this comment helps you to make better and more responsive designs.

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