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

Tailwind + JS? No problem - my take on the "Article Preview Component"

vite, tailwind-css
P
Michael•180
@Networksentinel
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?

This was the first project where I finally got to use Tailwind—and more importantly, JavaScript!

Tailwind really impressed me. It saves a ton of time, and if you're already comfortable with vanilla CSS, the transition is super smooth. You don’t have to switch between your HTML and CSS files all the time—just apply utility classes and focus on layout, styling, and fine-tuning the design.

I also got to put my basic JavaScript knowledge into action. I used variables, functions, if...else, addEventListener, and some DOM manipulation. It felt great to build the interactivity I needed without running into major issues. Even though it’s just beginner-level stuff, it was really satisfying to see it all work!

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

I wouldn’t call them full-on challenges, but I definitely needed some time to get used to working with Tailwind CSS—especially figuring out how to apply classes efficiently while keeping the HTML readable. It also took a bit to learn how to customize Tailwind classes when the default values weren’t quite what I needed, which was important for getting things pixel-perfect in a project like this.

To get past that, I watched a few basic Tailwind tutorials, referred to the official docs, and regularly used this CHEAT SHEET. That combo really helped me get comfortable with the workflow.

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

I’d really appreciate if someone could take a look at how I used Tailwind CSS and give me some feedback on how to keep it clean and readable. I tried to stay organized using comments, spacing, and indentation, but I’d love to pick up good habits early on and make sure I’m heading in the right direction.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • ebenkanin•410
    @ebenkanin
    Posted about 2 months ago

    Hi there! Congratulations on completing this challenge.loved your use of tailwind css for this. I have never built using vite. I always use the tailwind cli . it allows you to even clean up the classes nicely by packing recurring sets of classes you maybe using in each section into one class and just using it throughout. Do look into it when you have the time in the official tailwind documentation. It's under custom classes. Cheers to a good job done

    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

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