유투브 퍼오기 영상(iframe) 가로 높이 자동 변환하기
유투브나 기타 영상을 올릴때 아이프레임 형식이라서
스마트폰(가로/세로 바꾸면서)에 보여주기 할때 영상 가로세로 비율이 자동으로
변하지 않습니다. 그래서 여기저기 찾다가 발견해서 올려 봅니다.
출처 : http://kyouyoum.cafe24.com/archives/324
아래는 css에 넣어주시고요.
.video-container{position:relative;padding-bottom:56.25%;padding-top:30px;height:0;overflow:hidden;}
.video-container iframe,.video-container object,.video-container embed{position:absolute;top:0;left:0;width:100%;height:100%;}
아래는 아이프레임 들어갈 곳에 넣습니다.
<div class="video-container">
<iframe width="100%" height="315" src="//www.youtube.com/embed/qKbAxJhoQgE" frameborder="0" allowfullscreen></iframe>
</div>
스마트폰(가로/세로 바꾸면서)에 보여주기 할때 영상 가로세로 비율이 자동으로
변하지 않습니다. 그래서 여기저기 찾다가 발견해서 올려 봅니다.
출처 : http://kyouyoum.cafe24.com/archives/324
아래는 css에 넣어주시고요.
.video-container{position:relative;padding-bottom:56.25%;padding-top:30px;height:0;overflow:hidden;}
.video-container iframe,.video-container object,.video-container embed{position:absolute;top:0;left:0;width:100%;height:100%;}
아래는 아이프레임 들어갈 곳에 넣습니다.
<div class="video-container">
<iframe width="100%" height="315" src="//www.youtube.com/embed/qKbAxJhoQgE" frameborder="0" allowfullscreen></iframe>
</div>
댓글 10개
11년 전
좋은팁이네요~ ^^*
11년 전
감사합니다. 제가 직직접 만든 것은 아니지만..
11년 전
좋은 팁 감사합니다...
11년 전
좋은 돼요
감사합니다.
감사합니다.
9년 전
전 다른분의 소스코드를 사용해서 변경한 한방에 잘되었네요~
다른분들도 안되시면 참조해보세요~
http://unclepark.tistory.com/69
다른분들도 안되시면 참조해보세요~
http://unclepark.tistory.com/69
8년 전
css 파일을 여시고
iframe{width:100% !important;height:480px !important}
넣어주셔도 되요. 다만 iframe로 입력한건 다 적용되지만, 대부분 아이프레임으로 등록하는건 youtube가 많으니..
모바일에는
iframe{width:320px !important;height:200px !important}
iframe{width:100% !important;height:480px !important}
넣어주셔도 되요. 다만 iframe로 입력한건 다 적용되지만, 대부분 아이프레임으로 등록하는건 youtube가 많으니..
모바일에는
iframe{width:320px !important;height:200px !important}
7년 전
제가 초보라서 그러는데요, 어디에 있는 CSS 말씀하시는건지요?
6년 전
아이프레임 100%가 안 먹혀서 왜그런가 했네요...
드론아이님 덕분에 깔끔하게 해결했습니다 ^^
다이버시님 게시판 스킨 뷰 페이시 상단에
<style>
iframe{width:100% !important;height:480px !important}
</style>
넣으시면 되요~
드론아이님 덕분에 깔끔하게 해결했습니다 ^^
다이버시님 게시판 스킨 뷰 페이시 상단에
<style>
iframe{width:100% !important;height:480px !important}
</style>
넣으시면 되요~
6년 전
정말 감사합니다.
3년 전
감사합니다.
게시글 목록
| 번호 | 제목 |
|---|---|
| 24318 | |
| 24317 | |
| 24315 | |
| 24309 | |
| 24294 | |
| 24293 | |
| 24277 | |
| 24262 | |
| 24260 | |
| 24253 | |
| 24251 | |
| 24236 | |
| 24233 | |
| 24228 | |
| 24226 | |
| 24221 | |
| 24214 | |
| 24203 | |
| 24201 | |
| 24199 | |
| 24196 | |
| 24195 | |
| 24194 | |
| 24192 | |
| 24191 | |
| 24187 | |
| 24185 | |
| 24183 | |
| 24172 | |
| 24168 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기