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

- What is Tailwind CSS?
- The description of Recent article ui component
- Why use Tailwind CSS to create a Recent article ui component?
- The preview of Recent article ui component
- The source code of Recent article ui component
- How to create a Recent article with Tailwind CSS?
- Install tailwind css of verion 1.6.2
- All the unility class needed to create a Recent article component
- 55 steps to create a Recent article component with Tailwind CSS
- Conclusion
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
Control the text color of an element to gray-700 using the
text-gray-700
utilities.Control the horizontal padding of an element to 1.25rem using the
px-5
utilities.Control the vertical padding of an element to 6rem using the
py-24
utilities.Control the horizontal margin of an element to auto using the
mx-auto
utilities.Use
flex
to create a block-level flex container.Use
flex
to create a block-level flex container.Use
w-full
to set an element to a 100% based width.Control the margin on bottom side of an element to 5rem using the
mb-20
utilities.Use
flex
to create a block-level flex container.Control the text color of an element to center using the
text-center
utilities.Control the text color of an element to 3xl at only small screen sizes using the
sm:text-3xl
utilities.Control the text color of an element to 2xl using the
text-2xl
utilities.Control the margin on bottom side of an element to 0.5rem using the
mb-2
utilities.Control the text color of an element to gray-900 using the
text-gray-900
utilities.Use
lg:w-1/2
to set an element to a fixed width(1/2) at only large screen sizes.Control the text color of an element to base using the
text-base
utilities.Control the margin on all sides of an element to -1rem at only small screen sizes using the
sm:-m-4
utilities.Control the horizontal margin of an element to -1rem using the
-mx-4
utilities.Control the margin on bottom side of an element to -2.5rem using the
-mb-10
utilities.Control the margin on top side of an element to -1rem using the
-mt-4
utilities.Control the padding on all sides of an element to 1rem using the
p-4
utilities.Use
md:w-1/3
to set an element to a fixed width(1/3) at only medium screen sizes.Control the margin on bottom side of an element to 0rem at only medium screen sizes using the
md:mb-0
utilities.Control the margin on bottom side of an element to 1.5rem using the
mb-6
utilities.Set the maximum width/height of an element using the
max-w-sm
utilities.Control the background color of an element to gray-300 using the
bg-gray-300
utilities.Use
h-56
to set an element to a fixed height(14rem).Control the background color of an element to cover using the
bg-cover
utilities.Control the background color of an element to center using the
bg-center
utilities.Use
w-70
to set an element to a fixed width(17.5rem).Control the background color of an element to white using the
bg-white
utilities.Control the margin on top side of an element to -2.5rem using the
-mt-10
utilities.Use
overflow-hidden
to clip any content within an element that overflows the bounds of that element.Control the padding on all sides of an element to 1.25rem using the
p-5
utilities.Use
inline-flex
to create an inline flex container that flows with text.Use
flex
to create a block-level flex container.Use
h-4
to set an element to a fixed height(1rem).Use
w-4
to set an element to a fixed width(1rem).Control the margin on all sides of an element to 0.25rem using the
m-1
utilities.Control the background color of an element to purple-100 using the
bg-purple-100
utilities.Use
h-2
to set an element to a fixed height(0.5rem).Use
w-2
to set an element to a fixed width(0.5rem).Control the background color of an element to purple-500 using the
bg-purple-500
utilities.Control the text color of an element to sm using the
text-sm
utilities.Control the text color of an element to justify using the
text-justify
utilities.Control the background color of an element to blue-100 using the
bg-blue-100
utilities.Control the text color of an element to blue-500 using the
text-blue-500
utilities.Control the margin on top side of an element to 1rem using the
mt-4
utilities.Use
inline
utilities to put the element on its own line and fill its parent.Control the padding on all sides of an element to 0.5rem using the
p-2
utilities.Control the background color of an element to yellow-100 using the
bg-yellow-100
utilities.Control the background color of an element to yellow-500 using the
bg-yellow-500
utilities.Control the horizontal padding of an element to 0.5rem using the
px-2
utilities.Control the background color of an element to green-100 using the
bg-green-100
utilities.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.