Published on

A Complete Guide To Build A Circular SVG Showreel (css Only) With Tailwind CSS

Tags
Circular SVG Showreel (css only)

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 Circular SVG Showreel (css only) ui component

Play video on hover, animatetransform, svg animation, video

Why use Tailwind CSS to create a Circular SVG Showreel (css only) ui component?

  • It can make the building process of Circular SVG Showreel (css only) ui component faster and more easily.
  • Enables building complex responsive layouts and components freely.
  • Minimum lines of CSS code in Circular SVG Showreel (css only) component file.

The preview of Circular SVG Showreel (css only) ui component

Free download of the Circular SVG Showreel (css only)'s source code

The source code of Circular SVG Showreel (css only) ui component

<div class='flex items-center justify-center min-h-screen from-gray-100 via-gray-300 to-gay-500 bg-gradient-to-br'>
   <div class="relative w-full h-screen">
	<div class="absolute-center">
		<svg class="circle-svg" viewBox="0 0 500 500">
			<defs>
				<path d="M50,250c0-110.5,89.5-200,200-200s200,89.5,200,200s-89.5,200-200,200S50,360.5,50,250"
					id="textcircle_top">
					<animateTransform attributeName="transform" begin="0s" dur="20s" type="rotate" from="0 250 250"
						to="360 250 250" repeatCount="indefinite" />
				</path>
			</defs>
			<text class="circle-text" dy="70" textLength="1220">
				<textPath xlink:href="#textcircle_top">
					View Our Showreels View Our Showreels
				</textPath>
			</text>
		</svg>

	</div>
	<div class="absolute-center">
		<div class="showreels-div">
			<video class="showreels-video" loop autoplay muted>
				<source src='https://github.com/ahampriyanshu/gfg/raw/main/media/showreel.mp4' type="video/mp4" />
				<p>Please Update Your Browser</p>
			</video>
			<img
              alt="play"
              class="showreels-btn"
              src='https://github.com/ahampriyanshu/gfg/raw/main/media/play.png'
            />
          </div>
		</div>
	</div>
</div>
<style>
    		.showreels-btn {
			width: 25%;
			height: 25%;
			display: block;
			margin: 0;
			position: absolute;
			top: 50%;
			left: 55%;
			-ms-transform: translate(-55%, -50%);
			transform: translate(-55%, -50%);
		}

		.showreels-div:hover .showreels-video {
			display: block;
		}

		.showreels-div:hover .showreels-btn {
			display: none;
		}

        	.circle-text {
			font-size: 24px;
			font-weight: 700;
			text-transform: uppercase;
			letter-spacing: 10px;
			fill: #333;
		}

		.showreels-div {
			height: 150px;
			width: 150px;
			border-radius: 100%;
		}

		.showreels-video {
			border-radius: 100%;
			width: 100%;
			height: 100%;
			object-fit: cover;
			display: none;
		}

        	.circle-svg {
			height: 350px;
			width: 350px;
		}
        .absolute-center {
			margin: 0;
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate(-50%, -50%);
		}

</style>

How to create a Circular SVG Showreel (css only) with Tailwind CSS?

Install tailwind css of verion 2.2.19

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

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

All the unility class needed to create a Circular SVG Showreel (css only) component

  • relative
  • w-full
  • h-screen
  • absolute-center

4 steps to create a Circular SVG Showreel (css only) component with Tailwind CSS

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

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

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

  4. 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.

Conclusion

The above is a step-by-step tutorial on how to use Tailwind CSS to create a Circular SVG Showreel (css only) components, learn and follow along to implement your own components.