Published on

Learn How To Create A Simple Blog With Tailwind CSS from the Pros

Tags
Simple Blog

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 Simple Blog ui component

Sometimes keeping it simple is best.

Why use Tailwind CSS to build a Simple Blog ui component?

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

The preview of Simple Blog ui component

Free download of the Simple Blog's source code

The source code of Simple Blog ui component

<div class="h-96 w-screen bg-white">
  <header class="flex flex-wrap max-w-2xl px-4 py-4 mx-auto mb-4">
    <a
      href="https://www.ebey.me"
      class="inline-flex items-center p-2 hover:bg-yellow-100"
    >
      <svg class="inline-block w-5 h-5 mr-3 bg-black">
        <path d="M0 0h19v19H0z" />
      </svg>
      <span class="text-lg font-semibold">ebey.me</span>
    </a>

    <nav class="inline-flex items-center justify-end flex-grow">
      <a
        class="p-2 mr-2 text-xs font-semibold text-gray-700"
        href="https://github.com/jacob-ebey/ebey-me"
      >
        Source
      </a>
      <a
        href="https://twitter.com/ebey_jacob"
        class="p-2 text-xs font-semibold text-white bg-black"
      >
        Follow Me
      </a>
    </nav>
  </header>

  <div class="max-w-2xl mx-auto px-6 my-16">
    <section>
      <h1 class="mt-16 text-6xl font-bold">K.I.S.S</h1>
      <p class="w-full mt-16 text-gray-500 description md:w-2/3">
        Sometimes keeping it simple is best.
      </p>
      <a
        href="https://www.reddit.com/r/DunderMifflin/comments/7zubij/keep_it_simple_stupid/"
        class="inline-block mt-5 text-sm font-semibold uppercase hover:underline"
      >
        Dank meme alert
      </a>
    </section>
  </div>
</div>

How to build a Simple Blog with Tailwind CSS?

Install tailwind css of verion 2.0.3

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

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

All the unility class needed to build a Simple Blog component

  • h-96
  • w-screen
  • bg-white
  • flex
  • flex-wrap
  • max-w-2xl
  • px-4
  • py-4
  • mx-auto
  • mb-4
  • inline-flex
  • p-2
  • hover:bg-yellow-100
  • inline-block
  • w-5
  • h-5
  • mr-3
  • bg-black
  • text-lg
  • flex-grow
  • mr-2
  • text-xs
  • text-gray-700
  • text-white
  • px-6
  • my-16
  • mt-16
  • text-6xl
  • w-full
  • text-gray-500
  • md:w-2/3
  • mt-5
  • text-sm

33 steps to build a Simple Blog component with Tailwind CSS

  1. Use h-96 to set an element to a fixed height(24rem).

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

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

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

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

  6. Set the maximum width/height of an element using the max-w-2xl 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 1rem using the py-4 utilities.

  9. Control the horizontal margin of an element to auto using the mx-auto utilities.

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

  11. Use inline-flex to create an inline flex container that flows with text.

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

  13. Control the background color of an element to yellow-100 using the hover:bg-yellow-100 utilities on hover.

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

  15. Use w-5 to set an element to a fixed width(1.25rem).

  16. Use h-5 to set an element to a fixed height(1.25rem).

  17. Control the margin on right side of an element to 0.75rem using the mr-3 utilities.

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

  19. Control the text color of an element to lg using the text-lg utilities.

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

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

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

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

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

  25. Control the horizontal padding of an element to 1.5rem using the px-6 utilities.

  26. Control the vertical margin of an element to 4rem using the my-16 utilities.

  27. Control the margin on top side of an element to 4rem using the mt-16 utilities.

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

  29. Use w-full to set an element to a 100% based width.

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

  31. Use md:w-2/3 to set an element to a fixed width(2/3) at only medium screen sizes.

  32. Control the margin on top side of an element to 1.25rem using the mt-5 utilities.

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

Conclusion

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