Published on

6 Critical Skills To Create A LinkedIn Post With Tailwind CSS Remarkably Well

Tags
LinkedIn 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 LinkedIn Post ui component

Linkedin post with reactions and comments

Why use Tailwind CSS to create a LinkedIn Post ui component?

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

The preview of LinkedIn Post ui component

Free download of the LinkedIn Post's source code

The source code of LinkedIn Post ui component

<div class="bg-gray-100 p-3 flex items-center justify-center w-screen h-screen">
  <div class="bg-white border shadow-sm px-4 py-3 rounded-lg max-w-lg">
    <div class="flex items-center">
      <img class="h-12 w-12 rounded-full" src="https://images.unsplash.com/photo-1506794778202-cad84cf45f1d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80"/>
      <div class="ml-2">
        <div class="text-sm ">
          <span class="font-semibold">Dallin Baumbach</span>
          <span class="text-gray-500"> • 1st</span>
        </div>
        <div class="text-gray-500 text-xs ">Software Engineer at Tesla, Inc</div>
        <div class="text-gray-500 text-xs flex">
          <span class="inline-block">3d • Edited • </span>
          <svg class="inline-block ml-1 fill-current" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" data-supported-dps="16x16" fill="currentColor" class="mercado-match" width="16" height="16" focusable="false">
            <path d="M8 1a7 7 0 107 7 7 7 0 00-7-7zM3 8a5 5 0 011-3l.55.55A1.5 1.5 0 015 6.62v1.07a.75.75 0 00.22.53l.56.56a.75.75 0 00.53.22H7v.69a.75.75 0 00.22.53l.56.56a.75.75 0 01.22.53V13a5 5 0 01-5-5zm6.24 4.83l2-2.46a.75.75 0 00.09-.8l-.58-1.16A.76.76 0 0010 8H7v-.19a.51.51 0 01.28-.45l.38-.19a.74.74 0 01.68 0L9 7.5l.38-.7a1 1 0 00.12-.48v-.85a.78.78 0 01.21-.53l1.07-1.09a5 5 0 01-1.54 9z"></path>
          </svg>
        </div>
      </div>
    </div>
    <p class="text-gray-800 text-sm mt-2 leading-normal md:leading-relaxed">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <div class="text-gray-500 text-xs flex items-center mt-3">
      <img class="mr-0.5" src="https://static-exp1.licdn.com/sc/h/d310t2g24pvdy4pt1jkedo4yb"/>
      <img class="mr-0.5" src="https://static-exp1.licdn.com/sc/h/5thsbmikm6a8uov24ygwd914f"/>
      <img class="mr-0.5" src="https://static-exp1.licdn.com/sc/h/7fx9nkd7mx8avdpqm5hqcbi97"/>
      <span class="ml-1">47 • 26 comments</span>
    </div>
  </div>
</div>

How to create a LinkedIn Post with Tailwind CSS?

Install tailwind css of verion 2.0.1

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

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

All the unility class needed to create a LinkedIn Post component

  • bg-gray-100
  • p-3
  • flex
  • w-screen
  • h-screen
  • bg-white
  • px-4
  • py-3
  • max-w-lg
  • h-12
  • w-12
  • ml-2
  • text-sm
  • text-gray-500
  • text-xs
  • inline-block
  • ml-1
  • text-gray-800
  • mt-2
  • mt-3
  • mr-0.5

21 steps to create a LinkedIn Post component with Tailwind CSS

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

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

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

  4. Use w-screen to make an element span the entire width of the viewport.

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

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

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

  8. Control the vertical padding of an element to 0.75rem using the py-3 utilities.

  9. Set the maximum width/height of an element using the max-w-lg utilities.

  10. Use h-12 to set an element to a fixed height(3rem).

  11. Use w-12 to set an element to a fixed width(3rem).

  12. Control the margin on left side of an element to 0.5rem using the ml-2 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-500 using the text-gray-500 utilities.

  15. Control the text color of an element to xs using the text-xs utilities.

  16. Use inline-block utilities to wrap the element to prevent the text inside from extending beyond its parent.

  17. Control the margin on left side of an element to 0.25rem using the ml-1 utilities.

  18. Control the text color of an element to gray-800 using the text-gray-800 utilities.

  19. Control the margin on top side of an element to 0.5rem using the mt-2 utilities.

  20. Control the margin on top side of an element to 0.75rem using the mt-3 utilities.

  21. Control the margin on right side of an element to 0.5 using the mr-0.5 utilities.

Conclusion

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