Published on

6 Tips To Build A Landing Page With Twinkling Stars 🌟 With Tailwind CSS

Tags
Landing Page with twinkling stars 🌟

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 Landing Page with twinkling stars 🌟 ui component

This is the first section of one of my future templates. you need a little bit of js! :) also, i recommend to add a script that auto-reload the page on resize, to avoid blank space! simple and clear.

Why use Tailwind CSS to build a Landing Page with twinkling stars 🌟 ui component?

  • It can make the building process of Landing Page with twinkling stars 🌟 ui component faster and more easily.
  • Enables building complex responsive layouts and components freely.
  • Minimum lines of CSS code in Landing Page with twinkling stars 🌟 component file.

The preview of Landing Page with twinkling stars 🌟 ui component

Free download of the Landing Page with twinkling stars 🌟's source code

The source code of Landing Page with twinkling stars 🌟 ui component

<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<style>
.star {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 5px;
}

@keyframes twinkle {
  0% {
    transform: scale(1, 1);
    background: rgba(255, 255, 255, 0);
    animation-timing-function: linear;
  }
  40% {
    transform: scale(0.8, 0.8);
    background: rgba(255, 255, 255, 1);
    animation-timing-function: ease-out;
  }
  80% {
    background: rgba(255, 255, 255, 0);
    transform: scale(1, 1);
  }
  100% {
    background: rgba(255, 255, 255, 0);
    transform: scale(1, 1);
  }
}
</style>

<section
      class="homescreen m-0 flex flex-col w-screen justify-center bg-gray-800 h-screen text-gray-100 "
    >
      <nav>
        <ul class="flex justify-between text-xl py-8 px-8 md:px-48 ">
          <li>
            LOGO
          </li>
          <li>
            <a href="https://github.com/Icesofty" target="_blank" rel="noopener noreferrer">Made with 💚 by IceSofty</a>
          </li>
        </ul>
      </nav>

      <h1 class="text-6xl  my-auto mx-auto  md:mx-48 ">
        Delightful <br />
        <span class="text-teal-400">Web Templates.</span>
      </h1>
    </section>
<script>
for (var i = 0; i < 100; i++) {
  var star =
    '<div class="star m-0" style="animation: twinkle ' +
    (Math.random() * 5 + 5) +
    's linear ' +
    (Math.random() * 1 + 1) +
    's infinite; top: ' +
    Math.random() * $(window).height() +
    'px; left: ' +
    Math.random() * $(window).width() +
    'px;"></div>';
  $('.homescreen').append(star);
}

</script>

How to build a Landing Page with twinkling stars 🌟 with Tailwind CSS?

Install tailwind css of verion 1.2.0

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

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

All the unility class needed to build a Landing Page with twinkling stars 🌟 component

  • m-0
  • flex
  • flex-col
  • w-screen
  • bg-gray-800
  • h-screen
  • text-gray-100
  • text-xl
  • py-8
  • px-8
  • md:px-48
  • text-6xl
  • my-auto
  • mx-auto
  • md:mx-48
  • text-teal-400

16 steps to build a Landing Page with twinkling stars 🌟 component with Tailwind CSS

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

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

  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. Control the background color of an element to gray-800 using the bg-gray-800 utilities.

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

  7. Control the text color of an element to gray-100 using the text-gray-100 utilities.

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

  9. Control the vertical padding of an element to 2rem using the py-8 utilities.

  10. Control the horizontal padding of an element to 2rem using the px-8 utilities.

  11. Control the horizontal padding of an element to 12rem at only medium screen sizes using the md:px-48 utilities.

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

  13. Control the vertical margin of an element to auto using the my-auto utilities.

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

  15. Control the horizontal margin of an element to 12rem at only medium screen sizes using the md:mx-48 utilities.

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

Conclusion

The above is a step-by-step tutorial on how to use Tailwind CSS to build a Landing Page with twinkling stars 🌟 components, learn and follow along to implement your own components.