유튜브 높이값 자동조절하기 > 코딩소스

본문 바로가기
사이트 내 전체검색

코딩소스

etc 유튜브 높이값 자동조절하기

페이지 정보

profile_image
작성자 디블랙
댓글 0건 조회 232회 작성일 25-05-20 21:59

본문

.embed-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;max-width: 100%; height: auto; }
.embed-container iframe{ position: absolute; top: 0; left: 0; width: 100%; height: 100%; }


<div class="embed-container">
  <iframe width="560" height="315" src="https://www.youtube.com/embed/TuKdf_xvg2E?si=i2MWyeqFTzZQ0-Yy" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen=""></iframe>
</div>




padding-bottom: 56.25% 는 padding값을 주어 16:9 비율로 공간을 만드는것입니다.
padding-bottom:100% 라면 정사각형이 되는거에요. 반응형에서 이미지를 배경으로 처리할경우 높이값이 없기때문에 padding값을 주어 공간을 만들어 사용하기도 합니다.
노래하나 듣고 가시죠..^^

댓글목록

등록된 댓글이 없습니다.

회원로그인

회원가입

사이트 정보

회사명 : 디자인블랙 / 대표 : 공세헌
주소 : 부산광역시 해운대구 달맞이길65번길
전화 : 010-4577-5965

접속자집계

오늘
210
어제
579
최대
652
전체
6,998
Copyright © 소유하신 도메인. All rights reserved.