Skip to content
  • Learning paths
  • Challenges
  • Solutions
  • Articles
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted almost 2 years ago

Tailwind CSS

tailwind-css
Harshit Singh Tomar•30
@HarshitSinghT0mar
A solution to the Order summary component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hi, I used this challenge to learn tailwind css. I struggled with the background image thing, it looks like the same background image is used twice but the second time it roated horizontally and vertically both. How do I get the background pattern as its in the challenge?

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Boots 😺•1,610
    @adityaphasu
    Posted almost 2 years ago

    Hello!

    The issue you are experiencing is due to the background image repeating. By default, a background-image is repeated both vertically and horizontally therefore to avoid this generally in CSS background-repeat:no-repeat is used but since you are using tailwind you can add bg-no-repeat to the div.

    • You can add bg-[hsl(225, 100%, 94%)] (this is the pale blue color from the style guide) which will also apply a background color so it matches the design.

    Few tips while for tailwindcss to use upon the next project:

    • Instead of using inline style to add the background images using tailwind you can actually use the tailwind.config.js to add those images and use them simply using tailwind classes. This is how you do it:
    module.exports = {
      theme: {
        extend: {
          backgroundImage: {
            "desktop-pattern": "url('/images/pattern-background-desktop.svg')",
            "mobile-pattern": "url('/images/pattern-background-mobile.svg')",
        }
        }
      }
    }
    
    • After adding these you can in the html file just use bg-desktop-pattern or bg-mobile-pattern and the background image would get applied!
    • You can actually do the same thing for colors and various other properties as well. The config file is there to add custom values so that we can use them in a tailwind fashion.
    • Here give this page a read from docs to know more about it!

    Keep up the hard work and happy coding!🙂

    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