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

Order summary component using tailwindcss

Maksim 590

@MaxTarasevich

Desktop design screenshot for the Order summary component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Hey! This is my first project where I am using tailwindcss. It was very difficult for me to switch to writing classes for styling. Should I use BEM class naming for better code readability? Any comment would be welcome!

Community feedback

Antoine C 1,180

@mattari97

Posted

Hello. Nice one!

A little advice on tailwind. I see that you added a custom component like so

@tailwind base;
@tailwind components;
.btn{
  @apply  w-full rounded-xl p-3 mb-4 font-bold;
}
@tailwind utilities;

The recommended way to target a specific layer is to use the @layer directive like so:

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer components {
  .btn{
    @apply  w-full rounded-xl p-3 mb-4 font-bold;
  }
}

This way you don't have to worry on putting your custom classes before importing the @utilities and when you'll have more custom classes it will make the code more readable. Also you can easily split your styles in multiple sheets and still import them like so:

@tailwind base;
@tailwind components;
@tailwind utilities;

@import "custom-classes"

Peace.

Marked as helpful

0

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