유튜브 영상을 배경으로 쓰기 CSS > 그누보드5 팁자료실

그누보드5 팁자료실

유튜브 영상을 배경으로 쓰기 CSS 정보

유튜브 영상을 배경으로 쓰기 CSS

본문

3660969865_1547489424.9791.png

이런식으로 됩니다.

<style>
* { box-sizing: border-box; }
.video-background {
  background: #000;
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: -99;
}
.video-foreground,
.video-background iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#vidtop-content {
    top: 0;
    color: #fff;
}
.vid-info { position: absolute; top: 0; right: 0; width: 33%; background: rgba(0,0,0,0.3); color: #fff; padding: 1rem; font-family: Avenir, Helvetica, sans-serif; }
.vid-info h1 { font-size: 2rem; font-weight: 700; margin-top: 0; line-height: 1.2; }
.vid-info a { display: block; color: #fff; text-decoration: none; background: rgba(0,0,0,0.5); transition: .6s background; border-bottom: none; margin: 1rem auto; text-align: center; }
@media (min-aspect-ratio: 16/9) {
  .video-foreground { height: 300%; top: -100%; }
}
@media (max-aspect-ratio: 16/9) {
  .video-foreground { width: 300%; left: -100%; }
}
@media all and (max-width: 600px) {
.vid-info { width: 50%; padding: .5rem; }
.vid-info h1 { margin-bottom: .2rem; }
}
@media all and (max-width: 500px) {
.vid-info .acronym { display: none; }
}
</style>

<div class="video-background">
    <div class="video-foreground">
     <iframe class="ww" src="https://www.youtube-nocookie.com/embed/n0AY4ebPy4w?autoplay=1&loop=1&controls=0&vq=hd720" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
    </div>
  </div>
<div id="vidtop-content">
<div class="vid-info">
      <h1>YouTube</h1>
      <p>Good!</p>
  </div>
</div>
추천
10

댓글 15개

감사합니다~ 잘되네요.
다만 한가지~
위 소스로는 loop=1 이 안먹길래 검색해보니 버전이 바뀌었네요
아래 소스 참고해주세요.

<iframe class="ww" src="https://www.youtube.com/embed/PBCGYqX-Njw?rel=0&autoplay=1&version=3
    &loop=1&playlist=PBCGYqX-Njw&controls=1&vq=hd2160" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

version=3&loop=1
위 와같이 루프 앞에 버전이 표기되야 루프가 먹네요~

참고 : https://developers.google.com/youtube/player_parameters?hl=ko#loop
전체 2,411 |RSS
그누보드5 팁자료실 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT