Skip to content
  • Learning paths
  • Challenges
  • Solutions
  • Articles
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 1 year ago

Page with react and tailwind-css

react, tailwind-css
MokoPolo•20
@MokoPolo
A solution to the QR code component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


I tried to use react with this challenge. I've also never used tailwind css so that was a challenge as well. I ended up having to use some utility classes to undo things that it does like line-width. I was kind of hoping I could've just used the default tailwind classes to make such a simple page work.

Hopefully I can get some good input since I feel bad having to change things in the style tag.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • P
    Daniel 🛸•44,740
    @danielmrz-dev
    Posted over 1 year ago

    Hello @MokoPolo!

    Your solution looks great!

    I have a couple of suggestions for improvement:

    • In order to make your HTML code more semantic, and since that is the main title of the screen, replace the <div> with <h1>. Unlike what most people think, it's not just about the size and weight of the text.

    The <h1> to <h6> tags are used to define HTML headings. <h1> defines the most important heading. <h6> defines the least important heading. Only use one <h1> per page - this should represent the main heading/subject for the whole page. Also, do not skip heading levels - start with <h1>, then use <h2>, and so on.

    • Also, still about semantic HTML, replace your div.root with main.root.

    All these tag changes may have little or no visual impact but they make your HTML code more semantic and improve SEO optimization as well as the accessibility of your project.

    I hope it helps!

    Other than that, great job!

    Marked as helpful
  • fresnizky•40
    @fresnizky
    Posted over 1 year ago

    There are two ways in Tailwind to use specific values that don't match any of the classes provided by Tailwind

    You can use an arbitrary value, this is useful when you need to use some values a few times, you just use the basic class with the desired value between square brackets []. Let's say you need a font-size of 15px, you just use it like this

    <p class="text-[15px]">This content should be 15px</p>
    

    The second option is to create a custom value in tailwind.config.js. This will create a new class you can use (or override an existing one), so this is great when you need to reuse the same value in several places. If you want to add a new font-size named content to be 15px you should add the following to the theme section

    module.exports = {
    ...
    theme: {
        extends: {
            fontSize: {
                content: '15px'
            }
        }
    }
    ...
    }
    

    And then you can use it in the html like this:

    <p class="text-content">This content should be 15px</p>
    

    Hope this was helpful, you can check my solutions where I implement both of these approaches.

    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

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