Published on

Make A Recent Article With Tailwind CSS Like A Pro With The Help Of These 6 Tips

Tags
Recent article

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 Recent article ui component

A recent article for tailwind css

Why use Tailwind CSS to create a Recent article ui component?

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

The preview of Recent article ui component

Free download of the Recent article's source code

The source code of Recent article ui component

<style>
  .w-70 {
    width: 20rem;
	}
</style>

<section class="blog text-gray-700 body-font">
      <div class="container px-5 py-24 mx-auto">
        <div class="flex flex-wrap w-full mb-20 flex-col items-center text-center">
          <h1 class="sm:text-3xl text-2xl font-medium title-font mb-2 text-gray-900"> Blog</h1>
          <p class="lg:w-1/2 w-full leading-relaxed text-base">
            J'aime bien partager mes connaissances et des recherche intéressantes, pour le faire j'ai mis en place un blog personnel.
						Nous abordons plusieurs sujets intéressants et je donne quelques astuces et conseils aux jeunes développeurs pour mieux s'en sortir.          </p>
        </div>
        <div class="flex flex-wrap sm:-m-4 -mx-4 -mb-10 -mt-4">
          <div class="p-4 md:w-1/3 md:mb-0 mb-6 flex flex-col justify-center items-center max-w-sm mx-auto">
            <div class="bg-gray-300 h-56 w-full rounded-lg shadow-md bg-cover bg-center" style="background-image: url(https://images.unsplash.com/photo-1521185496955-15097b20c5fe?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1951&q=80"></div>

            <div class=" w-70 bg-white -mt-10 shadow-lg rounded-lg overflow-hidden p-5">
              
              <div class="header-content inline-flex ">
                <div class="category-badge flex-1  h-4 w-4 m rounded-full m-1 bg-purple-100">
                  <div class="h-2 w-2 rounded-full m-1 bg-purple-500 " ></div>
                </div>
                <div class="category-title flex-1 text-sm"> PHP</div>
              </div>
              <div class="title-post font-medium">Mon titre</div>

              <div class="summary-post text-base text-justify">Lorem ipsum dolor sit amet consectetur adipisicing elit. Perspiciatis veritatis vel suscipit ex dolore possimus iure. 
                <button class="bg-blue-100 text-blue-500 mt-4 block rounded p-2 text-sm "><span class="">Lire plus</span></button>
              </div>
             
            </div>
          </div>

          <div class="p-4 md:w-1/3 md:mb-0 mb-6 flex flex-col justify-center items-center max-w-sm mx-auto">
            <div class="bg-gray-300 h-56 w-full rounded-lg shadow-md bg-cover bg-center" style="background-image: url(https://images.unsplash.com/photo-1543966888-7c1dc482a810?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1951&q=80"></div>

            <div class=" w-70 bg-white -mt-10 shadow-lg rounded-lg overflow-hidden p-5">
              
              <div class="header-content inline-flex ">
                <div class="category-badge flex-1  h-4 w-4 m rounded-full m-1 bg-yellow-100">
                  <div class="h-2 w-2 rounded-full m-1 bg-yellow-500 " ></div>
                </div>
                <div class="category-title flex-1 text-sm"> JS</div>
              </div>
              <div class="title-post font-medium">Mon titre</div>

              <div class="summary-post text-base text-justify">Lorem ipsum dolor sit amet consectetur adipisicing elit. Perspiciatis veritatis vel suscipit ex dolore possimus iure. 
                <button class="bg-blue-100 text-blue-500 px-2 mt-4 block rounded p-2 text-sm"><span class="">Lire plus</span></button>
              </div>
             
            </div>
          </div>

          <div class="p-4 md:w-1/3 md:mb-0 mb-6 flex flex-col justify-center items-center max-w-sm mx-auto">
            <div class="bg-gray-300 h-56 w-full rounded-lg shadow-md bg-cover bg-center" style="background-image: url(https://images.unsplash.com/photo-1590608897129-79da98d15969?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1951&q=80"></div>

            <div class=" w-70 bg-white -mt-10 shadow-lg rounded-lg overflow-hidden p-5">
              
              <div class="header-content inline-flex ">
                <div class="category-badge flex-1  h-4 w-4 m rounded-full m-1 bg-green-100">
                  <div class="h-2 w-2 rounded-full m-1 bg-green-500 " ></div>
                </div>
                <div class="category-title flex-1 text-sm"> Vue</div>
              </div>
              <div class="title-post font-medium">Mon titre</div>

              <div class="summary-post text-base text-justify">Lorem ipsum dolor sit amet consectetur adipisicing elit. Perspiciatis veritatis vel suscipit ex dolore possimus iure. 
                <button class="bg-blue-100 text-blue-500 px-2 mt-4 block rounded p-2 text-sm"><span class="">Lire plus</span></button>
              </div>
             
            </div>
          </div>
         
        </div>
      </div>
    </section>

How to create a Recent article with Tailwind CSS?

Install tailwind css of verion 1.6.2

Use the link html tag to import the stylesheet of Tailwind CSS of the version 1.6.2

<link href=https://unpkg.com/[email protected]/dist/tailwind.min.css rel="stylesheet">

All the unility class needed to create a Recent article component

  • text-gray-700
  • px-5
  • py-24
  • mx-auto
  • flex
  • flex-wrap
  • w-full
  • mb-20
  • flex-col
  • text-center
  • sm:text-3xl
  • text-2xl
  • mb-2
  • text-gray-900
  • lg:w-1/2
  • text-base
  • sm:-m-4
  • -mx-4
  • -mb-10
  • -mt-4
  • p-4
  • md:w-1/3
  • md:mb-0
  • mb-6
  • max-w-sm
  • bg-gray-300
  • h-56
  • bg-cover
  • bg-center
  • w-70
  • bg-white
  • -mt-10
  • overflow-hidden
  • p-5
  • inline-flex
  • flex-1
  • h-4
  • w-4
  • m-1
  • bg-purple-100
  • h-2
  • w-2
  • bg-purple-500
  • text-sm
  • text-justify
  • bg-blue-100
  • text-blue-500
  • mt-4
  • block
  • p-2
  • bg-yellow-100
  • bg-yellow-500
  • px-2
  • bg-green-100
  • bg-green-500

55 steps to create a Recent article component with Tailwind CSS

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

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

  3. Control the vertical padding of an element to 6rem using the py-24 utilities.

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

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

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

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

  8. Control the margin on bottom side of an element to 5rem using the mb-20 utilities.

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

  10. Control the text color of an element to center using the text-center utilities.

  11. Control the text color of an element to 3xl at only small screen sizes using the sm:text-3xl utilities.

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

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

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

  15. Use lg:w-1/2 to set an element to a fixed width(1/2) at only large screen sizes.

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

  17. Control the margin on all sides of an element to -1rem at only small screen sizes using the sm:-m-4 utilities.

  18. Control the horizontal margin of an element to -1rem using the -mx-4 utilities.

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

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

  21. Control the padding on all sides of an element to 1rem using the p-4 utilities.

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

  23. Control the margin on bottom side of an element to 0rem at only medium screen sizes using the md:mb-0 utilities.

  24. Control the margin on bottom side of an element to 1.5rem using the mb-6 utilities.

  25. Set the maximum width/height of an element using the max-w-sm utilities.

  26. Control the background color of an element to gray-300 using the bg-gray-300 utilities.

  27. Use h-56 to set an element to a fixed height(14rem).

  28. Control the background color of an element to cover using the bg-cover utilities.

  29. Control the background color of an element to center using the bg-center utilities.

  30. Use w-70 to set an element to a fixed width(17.5rem).

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

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

  33. Use overflow-hidden to clip any content within an element that overflows the bounds of that element.

  34. Control the padding on all sides of an element to 1.25rem using the p-5 utilities.

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

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

  37. Use h-4 to set an element to a fixed height(1rem).

  38. Use w-4 to set an element to a fixed width(1rem).

  39. Control the margin on all sides of an element to 0.25rem using the m-1 utilities.

  40. Control the background color of an element to purple-100 using the bg-purple-100 utilities.

  41. Use h-2 to set an element to a fixed height(0.5rem).

  42. Use w-2 to set an element to a fixed width(0.5rem).

  43. Control the background color of an element to purple-500 using the bg-purple-500 utilities.

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

  45. Control the text color of an element to justify using the text-justify utilities.

  46. Control the background color of an element to blue-100 using the bg-blue-100 utilities.

  47. Control the text color of an element to blue-500 using the text-blue-500 utilities.

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

  49. Use inline utilities to put the element on its own line and fill its parent.

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

  51. Control the background color of an element to yellow-100 using the bg-yellow-100 utilities.

  52. Control the background color of an element to yellow-500 using the bg-yellow-500 utilities.

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

  54. Control the background color of an element to green-100 using the bg-green-100 utilities.

  55. Control the background color of an element to green-500 using the bg-green-500 utilities.

Conclusion

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