Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Interactive rating | Tailwind CSS + Next.js (first time trying it)

#next#tailwind-css

@KostasKv

Desktop design screenshot for the Interactive rating component coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Hi all!

For this challenge, I decided to try figuring out how to set up and use Next.js, and went with Tailwind CSS (which I've been learning for the past week) to implement the design.

It's been a bit of a struggle but I'm happy that I now at least know enough to build a basic site with Next.js :) Tailwind has been awesome. I love how quickly I can adjust the look of a site with Tailwind but I'm finding that the HTML can quickly get ugly and verbose.

I would love to get any feedback or advice, particularly on:

  • the project's overall structure in regards to Next.js (is there anything strange/out of place?)
  • Best practices and readability with Tailwind CSS. Any glaring bad practices that I should try to avoid in the future?

Community feedback

Elaineโ€ข 11,420

@elaineleung

Posted

Hi Kostas, great job building this using Next.js ๐Ÿ˜Š

As far as I can tell on the Next.js front, everything looks great in your app and in your code; I looked through the files and didn't notice anything strangely out of place. I'm not familiar with Tailwind's classes, but in any case, the only comment I have is, in your CSS you can try separating your normalize/reset rules instead of lumping them together with the body and html, and what's normally used as normalize/reset for both would have at least the height or min-height property. I'd also only have styles on the body and not combine it with html.

In any case, right now when I shrink the height of the browser, the contents are covered by the browser window, and you'd also see the background disappearing at the bottom with the black coming through; the footer also is pushed up into the card. I had a look at your TW classes, and I think this may have something to do with the flex centering properties you have in the child div of your main. I'd try removing them, and then put them elsewhere, like the main. I also think having the background on this div is causing the black to bleed through.

Anyway, great job on the whole! ๐Ÿ™‚

Marked as helpful

1

@KostasKv

Posted

@elaineleung Hi Elaine, thanks for the in-depth response, I really appreciate it!

I'm glad you've pointed out the issue with shrinking the browser vertically. That wasn't something I was ever checking before and now I know to look for it.

I've figured out the issue and fixed it. Just simply had to add a large enough min-height to main. The problem was that the child div for the component had a fixed height while its parent, main, took on the screen height (100vh). This would cause the div to spill out from main when the screen height was too small, causing all the weirdness.

I don't know much about normalising/resetting in CSS yet so I'll read up on it, cheers for bringing it up. Everything in that CSS file (except for font) was the default from using Create Next App, so I just left it as is.

Thanks again :)

1
Elaineโ€ข 11,420

@elaineleung

Posted

@KostasKv No problem Kostas, it looks great right now ๐Ÿ™‚

Yes, I did see the h-screen class you had on the child and thought about mentioning min-height, but I also thought you'd probably figure it out in the end anyway, and glad you did!

1
buneeโ€ข 2,060

@buneeIsSlo

Posted

Hey! @KostasKv, I have no experience with any of the technologies you've used, but your solution looks great, and responds well too!

If you're using VScode you might find this extension helpful :)

Marked as helpful

1

@KostasKv

Posted

@buneeIsSlo Thanks! Just tried the extension and I like it already :D

1

Please log in to post a comment

Log in with GitHub
Discord logo

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