Tailwind CSS 비디오 (Video) 컴포넌트
HTML5 비디오 플레이어에 내부 영상을 삽입하고, 자동 재생(autoplay)이나 음소거(muted) 같은 옵션을 설정해서 사용자 경험을 높이는 비디오 컴포넌트를 써볼게요. Flowbite에서 제공하는 유틸리티 클래스를 활용하면 화면 폭에 맞게 딱 떨어지는 영상 플레이어를 바로 만들 수 있어요.
출처: 문서
본문
비디오 플레이어 (Video player)
브라우저 기본 비디오 플레이어를 만들고, Tailwind CSS의 w-full 유틸리티 클래스를 적용해서 부모 컨테이너의 전체 폭을 채우는 예시를 보여드릴게요.
<video class="w-full rounded-base" controls>
<source src="/docs/videos/flowbite.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
자동 재생과 음소거 옵션을 함께 적용한 예시도 있어요.
<video class="w-full rounded-base" autoplay muted controls>
<source src="/docs/videos/flowbite.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
고정된 너비(w-96), 고정된 높이(h-80), 반응형(w-full h-auto max-w-full), 그리고 테두리를 추가한 버전 등 다양하게 조합할 수 있어요.
<video class="w-96 rounded-base" controls>
<source src="/docs/videos/flowbite.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<video class="h-80 rounded-base" controls>
<source src="/docs/videos/flowbite.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<video class="w-full h-auto max-w-full rounded-base" controls>
<source src="/docs/videos/flowbite.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<video class="w-full h-auto max-w-full border border-default rounded-base" controls>
<source src="/docs/videos/flowbite.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
더 알아보기 (Learn more)
- 비디오 플레이어의 다양한 옵션과 클래스 조합은 공식 문서를 참고해 보세요.
- Tailwind CSS의 유틸리티 클래스를 조합하면 크기와 스타일을 자유롭게 바꿀 수 있어요.