Published on

6 Steps To Build A Tin Tức With Tailwind CSS Like A Pro In Under An Hour

Tags
Tin Tức

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 Tin Tức ui component

Tin tức nguồn chưa rõ

Why use Tailwind CSS to create a Tin Tức ui component?

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

The preview of Tin Tức ui component

Free download of the Tin Tức's source code

The source code of Tin Tức ui component

<div class="min-w-screen min-h-screen bg-gray-200 flex items-center justify-center px-5 py-5">
    <div class="bg-white text-gray-800 rounded-xl shadow-lg overflow-hidden relative flex" style="width:414px;height:736px">
        <div class="bg-white h-full w-full px-5 pt-6 pb-20 overflow-y-auto">
            <div class="mb-3">
                <h1 class="text-3xl font-bold">Today</h1>
                <p class="text-sm text-gray-500 uppercase font-bold">THURSDAY 6 AUGUST</p>
            </div>
            <div class="mb-5">
                <a href="#" class="block rounded-lg relative p-5 transform transition-all duration-300 scale-100 hover:scale-95" style="background: url(https://images.unsplash.com/photo-1484876065684-b683cf17d276?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=668&q=80) center; background-size: cover;">
                    <div class="absolute top-0 right-0 -mt-3 mr-3">
                        <div class="rounded-full bg-indigo-500 text-white text-xs py-1 pl-2 pr-3 leading-none"><i class="mdi mdi-fire text-base align-middle"></i> <span class="align-middle">FRESH</span></div>
                    </div>
                    <div class="h-48"></div>
                    <h2 class="text-white text-2xl font-bold leading-tight mb-3 pr-5">Tasnim Lacey New Album Out&nbsp;Now</h2>
                    <div class="flex w-full items-center text-sm text-gray-300 font-medium">
                        <div class="flex-1 flex items-center">
                            <div class="rounded-full w-8 h-8 mr-3" style="background: url(https://randomuser.me/api/portraits/women/74.jpg) center; background-size: cover;"></div>
                            <div>Gwen Thomson</div>
                        </div>
                        <div><i class="mdi mdi-thumb-up"></i> 18</div>
                    </div>
                </a>
            </div>
            <div class="mb-5">
                <a href="#" class="block rounded-lg relative p-5 transform transition-all duration-300 scale-100 hover:scale-95" style="background: url(https://images.unsplash.com/photo-1470337458703-46ad1756a187?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1649&q=80) center; background-size: cover;">
                    <div class="h-48"></div>
                    <h2 class="text-white text-2xl font-bold leading-tight mb-3 pr-5">Top 5 Cocktail Bars in&nbsp;NYC</h2>
                    <div class="flex w-full items-center text-sm text-gray-300 font-medium">
                        <div class="flex-1 flex items-center">
                            <div class="rounded-full w-8 h-8 mr-3" style="background: url(https://randomuser.me/api/portraits/women/55.jpg) center; background-size: cover;"></div>
                            <div>Kayden Buckley</div>
                        </div>
                        <div><i class="mdi mdi-thumb-up"></i> 7</div>
                    </div>
                </a>
            </div>
            <div class="mb-3">
                <h1 class="text-3xl font-bold">Yesterday</h1>
                <p class="text-sm text-gray-500 uppercase font-bold">WEDNESDAY 5 AUGUST</p>
            </div>
            <div class="flex -mx-1 mb-5">
                <div class="w-1/2 px-1">
                    <a href="#" class="block mb-2 p-5 rounded overflow-hidden transform transition-all duration-300 scale-100 hover:scale-95" style="background: url(https://images.unsplash.com/photo-1470225620780-dba8ba36b745?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60) center; background-size: cover;">
                        <div class="h-24"></div>
                        <h3 class="text-lg font-bold text-white leading-tight">DJ Dan Spins The Wheels</h3>
                    </a>
                    <a href="#" class="block mb-2 p-5 rounded overflow-hidden transform transition-all duration-300 scale-100 hover:scale-95" style="background: url(https://images.unsplash.com/photo-1534329539061-64caeb388c42?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60) center; background-size: cover;">
                        <div class="h-32"></div>
                        <h3 class="text-lg font-bold text-white leading-tight">Top Travels Destinations For 2020</h3>
                    </a>
                </div>
                <div class="w-1/2 px-1">
                    <a href="#" class="block mb-2 p-5 rounded overflow-hidden transform transition-all duration-300 scale-100 hover:scale-95" style="background: url(https://images.unsplash.com/photo-1526661934280-676cef25bc9b?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60) center; background-size: cover;">
                        <div class="h-32"></div>
                        <h3 class="text-lg font-bold text-white leading-tight">M&S Launches New Makeup Range!</h3>
                    </a>
                    <a href="#" class="block mb-2 p-5 rounded overflow-hidden transform transition-all duration-300 scale-100 hover:scale-95" style="background: url(https://images.unsplash.com/photo-1558365849-6ebd8b0454b2?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60) center; background-size: cover;">
                        <div class="h-24"></div>
                        <h3 class="text-lg font-bold text-white leading-tight">APT Set To Be A&nbsp;Ripper</h3>
                    </a>
                </div>
            </div>
            <div class="mb-3">
                <h1 class="text-3xl font-bold">Previous</h1>
            </div>
            <div>
                <a href="#" class="flex w-full transform transition-all duration-300 scale-100 hover:scale-95">
                    <div class="block h-24 w-2/5 rounded overflow-hidden" style="background: url(https://images.unsplash.com/photo-1530549387789-4c1017266635?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60) center; background-size: cover;"></div>
                    <div class="pl-3 w-3/5">
                        <p class="text-xs text-gray-500 uppercase font-semibold">SPORTS</p>
                        <h3 class="text-md font-semibold leading-tight mb-3">Lorem ipsum dolor sit amet consectetur adipisicing elit</h3>
                        <div class="flex w-full items-center text-xs text-gray-500 font-medium">
                            <div class="rounded-full w-5 h-5 mr-3" style="background: url(https://randomuser.me/api/portraits/men/41.jpg) center; background-size: cover;"></div>
                            <div>Jack Ryan</div>
                        </div>
                    </div>
                </a>
            </div>
            <hr class="border-gray-200 my-3">
            <div>
                <a href="#" class="flex w-full transform transition-all duration-300 scale-100 hover:scale-95">
                    <div class="block h-24 w-2/5 rounded overflow-hidden" style="background: url(https://images.unsplash.com/photo-1499781350541-7783f6c6a0c8?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60) center; background-size: cover;"></div>
                    <div class="pl-3 w-3/5">
                        <p class="text-xs text-gray-500 uppercase font-semibold">ART</p>
                        <h3 class="text-md font-semibold leading-tight mb-3">Lorem ipsum dolor sit amet consectetur adipisicing elit</h3>
                        <div class="flex w-full items-center text-xs text-gray-500 font-medium">
                            <div class="rounded-full w-5 h-5 mr-3" style="background: url(https://randomuser.me/api/portraits/men/63.jpg) center; background-size: cover;"></div>
                            <div>Kevin Jackson</div>
                        </div>
                    </div>
                </a>
            </div>
            <hr class="border-gray-200 my-3">
            <div>
                <a href="#" class="flex w-full transform transition-all duration-300 scale-100 hover:scale-95">
                    <div class="block h-24 w-2/5 rounded overflow-hidden" style="background: url(https://images.unsplash.com/photo-1505740420928-5e560c06d30e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60) center; background-size: cover;"></div>
                    <div class="pl-3 w-3/5">
                        <p class="text-xs text-gray-500 uppercase font-semibold">MUSIC</p>
                        <h3 class="text-md font-semibold leading-tight mb-3">Lorem ipsum dolor sit amet consectetur adipisicing elit</h3>
                        <div class="flex w-full items-center text-xs text-gray-500 font-medium">
                            <div class="rounded-full w-5 h-5 mr-3" style="background: url(https://randomuser.me/api/portraits/women/11.jpg) center; background-size: cover;"></div>
                            <div>Rowena Wheeler</div>
                        </div>
                    </div>
                </a>
            </div>
            <hr class="border-gray-200 my-3">
            <div>
                <a href="#" class="flex w-full transform transition-all duration-300 scale-100 hover:scale-95">
                    <div class="block h-24 w-2/5 rounded overflow-hidden" style="background: url(https://images.unsplash.com/photo-1511068797325-6083f0f872b1?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60) center; background-size: cover;"></div>
                    <div class="pl-3 w-3/5">
                        <p class="text-xs text-gray-500 uppercase font-semibold">WORLD</p>
                        <h3 class="text-md font-semibold leading-tight mb-3">Lorem ipsum dolor sit amet consectetur adipisicing elit</h3>
                        <div class="flex w-full items-center text-xs text-gray-500 font-medium">
                            <div class="rounded-full w-5 h-5 mr-3" style="background: url(https://randomuser.me/api/portraits/women/74.jpg) center; background-size: cover;"></div>
                            <div>Gwen Thomson</div>
                        </div>
                    </div>
                </a>
            </div>
        </div>
        <div class="bg-white absolute bottom-0 w-full border-t border-gray-200 flex">
            <a href="#" class="flex flex-grow items-center justify-center p-2 text-indigo-500 hover:text-indigo-500">
                <div class="text-center">
                    <span class="block h-8 text-3xl leading-8">
                        <i class="mdi mdi-newspaper-variant-outline"></i>
                    </span>
                    <span class="block text-xs leading-none">Today</span>
                </div>
            </a>
            <a href="#" class="flex flex-grow items-center justify-center p-2 text-gray-500 hover:text-indigo-500">
                <div class="text-center">
                    <span class="block h-8 text-3xl leading-8">
                        <i class="mdi mdi-apps"></i>
                    </span>
                    <span class="block text-xs leading-none">Categories</span>
                </div>
            </a>
            <a href="#" class="flex flex-grow items-center justify-center p-2 text-gray-500 hover:text-indigo-500">
                <div class="text-center">
                    <span class="block h-8 text-3xl leading-8">
                        <i class="mdi mdi-star-outline"></i>
                    </span>
                    <span class="block text-xs leading-none">Favorites</span>
                </div>
            </a>
            <a href="#" class="flex flex-grow items-center justify-center p-2 text-gray-500 hover:text-indigo-500">
                <div class="text-center">
                    <span class="block h-8 text-3xl leading-8">
                        <i class="mdi mdi-magnify"></i>
                    </span>
                    <span class="block text-xs leading-none">Search</span>
                </div>
            </a>
        </div>
    </div>
</div>

<!-- BUY ME A BEER AND HELP SUPPORT OPEN-SOURCE RESOURCES -->
<div class="flex items-end justify-end fixed bottom-0 right-0 mb-4 mr-4 z-10">
    <div>
        <a title="Buy me a beer" href="https://www.buymeacoffee.com/scottwindon" target="_blank" class="block w-16 h-16 rounded-full transition-all shadow hover:shadow-lg transform hover:scale-110 hover:rotate-12">
            <img class="object-cover object-center w-full h-full rounded-full" src="https://i.pinimg.com/originals/60/fd/e8/60fde811b6be57094e0abc69d9c2622a.jpg"/>
        </a>
    </div>
</div>

How to create a Tin Tức with Tailwind CSS?

Install tailwind css of verion 2.1.0

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

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

All the unility class needed to create a Tin Tức component

  • min-w-screen
  • min-h-screen
  • bg-gray-200
  • flex
  • px-5
  • py-5
  • bg-white
  • text-gray-800
  • overflow-hidden
  • relative
  • h-full
  • w-full
  • pt-6
  • pb-20
  • overflow-y-auto
  • mb-3
  • text-3xl
  • text-sm
  • text-gray-500
  • mb-5
  • block
  • p-5
  • absolute
  • top-0
  • right-0
  • -mt-3
  • mr-3
  • bg-indigo-500
  • text-white
  • text-xs
  • py-1
  • pl-2
  • pr-3
  • text-base
  • h-48
  • text-2xl
  • pr-5
  • text-gray-300
  • flex-1
  • w-8
  • h-8
  • -mx-1
  • w-1/2
  • px-1
  • mb-2
  • h-24
  • text-lg
  • h-32
  • w-2/5
  • pl-3
  • w-3/5
  • text-md
  • w-5
  • h-5
  • border-gray-200
  • my-3
  • bottom-0
  • border-t
  • flex-grow
  • p-2
  • text-indigo-500
  • hover:text-indigo-500
  • text-center
  • fixed
  • mb-4
  • mr-4
  • z-10
  • w-16
  • h-16

69 steps to create a Tin Tức component with Tailwind CSS

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

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

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

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

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

  6. Control the vertical padding of an element to 1.25rem using the py-5 utilities.

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

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

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

  10. Use relative to position an element according to the normal flow of the document.

  11. Use h-full to set an element’s height to 100% of its parent, as long as the parent has a defined height.

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

  13. Control the padding on top side of an element to 1.5rem using the pt-6 utilities.

  14. Control the padding on bottom side of an element to 5rem using the pb-20 utilities.

  15. Use overflow-y-auto to allow vertical scrolling if needed.

  16. Control the margin on bottom side of an element to 0.75rem using the mb-3 utilities.

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

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

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

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

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

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

  23. Use absolute to position an element outside of the normal flow of the document, causing neighboring elements to act as if the element doesn’t exist.

  24. Use the top-0 utilities to set the top position of a positioned element to 0rem.

  25. Use the right-0 utilities to set the right position of a positioned element to 0rem.

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

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

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

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

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

  31. Control the vertical padding of an element to 0.25rem using the py-1 utilities.

  32. Set the left padding of the element to 0.5rem using the pl-2 utilities class

  33. Control the padding on right side of an element to 0.75rem using the pr-3 utilities.

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

  35. Use h-48 to set an element to a fixed height(12rem).

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

  37. Control the padding on right side of an element to 1.25rem using the pr-5 utilities.

  38. Control the text color of an element to gray-300 using the text-gray-300 utilities.

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

  40. Use w-8 to set an element to a fixed width(2rem).

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

  42. Control the horizontal margin of an element to -0.25rem using the -mx-1 utilities.

  43. Use w-1/2 to set an element to a fixed width(1/2).

  44. Control the horizontal padding of an element to 0.25rem using the px-1 utilities.

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

  46. Use h-24 to set an element to a fixed height(6rem).

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

  48. Use h-32 to set an element to a fixed height(8rem).

  49. Use w-2/5 to set an element to a fixed width(2/5).

  50. Set the left padding of the element to 0.75rem using the pl-3 utilities class

  51. Use w-3/5 to set an element to a fixed width(3/5).

  52. Control the text color of an element to md using the text-md utilities.

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

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

  55. Control the border color of an element to gray-200 using the border-gray-200 utilities.

  56. Control the vertical margin of an element to 0.75rem using the my-3 utilities.

  57. Use the bottom-0 utilities to set the bottom position of a positioned element to 0rem.

  58. Control the border color of an element to t using the border-t utilities.

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

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

  61. Control the text color of an element to indigo-500 using the text-indigo-500 utilities.

  62. Control the text color of an element to indigo-500 on hover using the hover:text-indigo-500 utilities.

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

  64. Use fixed to position an element relative to the browser window.

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

  66. Control the margin on right side of an element to 1rem using the mr-4 utilities.

  67. Control the stack order (or three-dimensional positioning) of an element to 10 in Tailwind, regardless of order it has been displayed, using the z-10 utilities.

  68. Use w-16 to set an element to a fixed width(4rem).

  69. Use h-16 to set an element to a fixed height(4rem).

Conclusion

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