Published on

How to Make A Twitter - Following Recommendation With Tailwind CSS?

Twitter - Following Recommendation

What is Tailwind CSS?

Tailwind CSS is a utility-first CSS framework that focuses on creating personalized user interfaces quickly. It can gives you all the building blocks you are able to create personalized designs without having to fight to override irritating opinionated styles. Also, Tailwind CSS is a highly configurable, low-level CSS framework.

The description of Twitter - Following Recommendation ui component

Twitter following recommendation

Why use Tailwind CSS to create a Twitter - Following Recommendation ui component?

  • It can make the building process of Twitter - Following Recommendation ui component faster and more easily.
  • Enables building complex responsive layouts and components freely.
  • Minimum lines of CSS code in Twitter - Following Recommendation component file.

The preview of Twitter - Following Recommendation ui component

Free download of the Twitter - Following Recommendation's source code

The source code of Twitter - Following Recommendation ui component

<div class="bg-black h-screen items-center justify-center flex">
  
  <card class="bg-gray-900 text-gray-200 w-96 rounded-lg">
    
    <header class="font-bold text-2xl px-5 py-4">
      Who to follow
    </header>
    
    <main class="px-5">
      
      <content class="grid grid-cols-6">
        
        <div class="">
          <img src="https://picsum.photos/200/200" class="h-14 w-14 rounded-full" />
        </div>
        
        <div class="col-span-3 px-3 font-semibold flex flex-col"> 
          <div class=""> Sandy Budiman </div>
          <div class="text-sm text-gray-400 font-light"> @sandyversion </div>
        </div>
        
        <div class="col-span-2 py-2 justify-self-end">
          <button class="bg-gray-200 text-gray-900 font-bold text-md rounded-full py-1 px-4">
            Follow
          </button>
        </div>
        
      </content>
      
      
    </main>
    
    <footer class="px-5 py-4 text-blue-600">
      Show more
    </footer>
      
  </card>
  
</div>

How to create a Twitter - Following Recommendation with Tailwind CSS?

Install tailwind css of verion 3.0.18

Use the script html tag to import the script of Tailwind CSS of the version 3.0.18

<script src="https://cdn.tailwindcss.com"></script>

All the unility class needed to create a Twitter - Following Recommendation component

  • bg-black
  • h-screen
  • flex
  • bg-gray-900
  • text-gray-200
  • w-96
  • text-2xl
  • px-5
  • py-4
  • grid
  • grid-cols-6
  • h-14
  • w-14
  • px-3
  • flex-col
  • text-sm
  • text-gray-400
  • py-2
  • bg-gray-200
  • text-gray-900
  • text-md
  • py-1
  • px-4
  • text-blue-600

24 steps to create a Twitter - Following Recommendation component with Tailwind CSS

  1. Control the background color of an element to black using the bg-black utilities.

  2. Use h-screen to make an element span the entire height of the viewport.

  3. Use flex to create a block-level flex container.

  4. Control the background color of an element to gray-900 using the bg-gray-900 utilities.

  5. Control the text color of an element to gray-200 using the text-gray-200 utilities.

  6. Use w-96 to set an element to a fixed width(24rem).

  7. Control the text color of an element to 2xl using the text-2xl utilities.

  8. Control the horizontal padding of an element to 1.25rem using the px-5 utilities.

  9. Control the vertical padding of an element to 1rem using the py-4 utilities.

  10. Use grid to create a grid container.

  11. Use grid to create a grid container.

  12. Use h-14 to set an element to a fixed height(3.5rem).

  13. Use w-14 to set an element to a fixed width(3.5rem).

  14. Control the horizontal padding of an element to 0.75rem using the px-3 utilities.

  15. Use flex to create a block-level flex container.

  16. Control the text color of an element to sm using the text-sm utilities.

  17. Control the text color of an element to gray-400 using the text-gray-400 utilities.

  18. Control the vertical padding of an element to 0.5rem using the py-2 utilities.

  19. Control the background color of an element to gray-200 using the bg-gray-200 utilities.

  20. Control the text color of an element to gray-900 using the text-gray-900 utilities.

  21. Control the text color of an element to md using the text-md utilities.

  22. Control the vertical padding of an element to 0.25rem using the py-1 utilities.

  23. Control the horizontal padding of an element to 1rem using the px-4 utilities.

  24. Control the text color of an element to blue-600 using the text-blue-600 utilities.

Conclusion

The above is a step-by-step tutorial on how to use Tailwind CSS to create a Twitter - Following Recommendation components, learn and follow along to implement your own components.