Published on

What You Need To Make A Natural Post With Tailwind CSS

Tags
Natural Post

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 Natural Post ui component

Natural post

Why use Tailwind CSS to make a Natural Post ui component?

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

The preview of Natural Post ui component

Free download of the Natural Post's source code

The source code of Natural Post ui component

<!-- Create By Joker Banny -->
<div class="min-h-screen bg-gray-100 flex items-center justify-center">
  <div class="w-80 bg-white rounded-lg py-2 shadow-lg hover:shadow-2xl transition duration-500 transform hover:scale-105 cursor-pointer">
    <div class="flex items-center mb-2 space-x-4">
      <img class="w-10 rounded-full ml-2" src="https://www.adobe.com/express/create/media_1bcd514348a568faed99e65f5249895e38b06c947.jpeg?width=2000&format=webply&optimize=medium" alt="David" />
      <div>
        <h1 class="mb-1 text-xl font-bold text-gray-700">Stuar Manson</h1>
        <p class="text-sm font-normal text-gray-600 mr-14 hover:underline">#Publicado hace 2 horas</p>
      </div>
      <span>
        <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 hover:text-blue-400 transition duration-200" fill="none" viewBox="0 0 24 24" stroke="currentColor">
          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z" />
        </svg>
      </span>
    </div>
    <img src="https://images.unsplash.com/photo-1559128010-7c1ad6e1b6a5?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1052&q=80" alt="" />
    <div class="flex justify-between px-10 py-6">
      <span
        ><svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-red-500" viewBox="0 0 20 20" fill="currentColor">
          <path fill-rule="evenodd" d="M3.172 5.172a4 4 0 015.656 0L10 6.343l1.172-1.171a4 4 0 115.656 5.656L10 17.657l-6.828-6.829a4 4 0 010-5.656z" clip-rule="evenodd" /></svg
      ></span>
      <span>
        <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z" />
        </svg>
      </span>
      <span
        ><svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" viewBox="0 0 20 20" fill="currentColor">
          <path fill-rule="evenodd" d="M10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z" clip-rule="evenodd" /></svg
      ></span>
    </div>
    <div>
      <img src="" alt="" />
      <div class="px-10">
        <input class=" text-sm font-thin  px-5 py-2 mb-2 bg-gray-50 outline-none rounded-full border-1" type="text" placeholder="Enter your comment" />
        <span class="text-sm text-gray-500 bg-gray-50 p-2 rounded-full px-2 py-2 transition duration-100 hover:text-blue-400 cursor-pointer">Send</span>
      </div>
    </div>
  </div>
</div>

How to make a Natural Post with Tailwind CSS?

Install tailwind css of verion 2.2.4

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

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

All the unility class needed to make a Natural Post component

  • min-h-screen
  • bg-gray-100
  • flex
  • w-80
  • bg-white
  • py-2
  • mb-2
  • w-10
  • ml-2
  • mb-1
  • text-xl
  • text-gray-700
  • text-sm
  • text-gray-600
  • mr-14
  • h-6
  • w-6
  • hover:text-blue-400
  • px-10
  • py-6
  • text-red-500
  • px-5
  • bg-gray-50
  • border-1
  • text-gray-500
  • p-2
  • px-2

27 steps to make a Natural Post component with Tailwind CSS

  1. Set the minimum width/height of an element using the min-h-screen utilities.

  2. Control the background color of an element to gray-100 using the bg-gray-100 utilities.

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

  4. Use w-80 to set an element to a fixed width(20rem).

  5. Control the background color of an element to white using the bg-white utilities.

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

  7. Control the margin on bottom side of an element to 0.5rem using the mb-2 utilities.

  8. Use w-10 to set an element to a fixed width(2.5rem).

  9. Control the margin on left side of an element to 0.5rem using the ml-2 utilities.

  10. Control the margin on bottom side of an element to 0.25rem using the mb-1 utilities.

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

  12. Control the text color of an element to gray-700 using the text-gray-700 utilities.

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

  14. Control the text color of an element to gray-600 using the text-gray-600 utilities.

  15. Control the margin on right side of an element to 3.5rem using the mr-14 utilities.

  16. Use h-6 to set an element to a fixed height(1.5rem).

  17. Use w-6 to set an element to a fixed width(1.5rem).

  18. Control the text color of an element to blue-400 on hover using the hover:text-blue-400 utilities.

  19. Control the horizontal padding of an element to 2.5rem using the px-10 utilities.

  20. Control the vertical padding of an element to 1.5rem using the py-6 utilities.

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

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

  23. Control the background color of an element to gray-50 using the bg-gray-50 utilities.

  24. Control the border color of an element to 0.25rem using the border-1 utilities.

  25. Control the text color of an element to gray-500 using the text-gray-500 utilities.

  26. Control the padding on all sides of an element to 0.5rem using the p-2 utilities.

  27. Control the horizontal padding of an element to 0.5rem using the px-2 utilities.

Conclusion

The above is a step-by-step tutorial on how to use Tailwind CSS to make a Natural Post components, learn and follow along to implement your own components.