Computer >> 컴퓨터 >  >> 프로그램 작성 >> CSS

비디오 플레이어에 반응형 CSS max-width 속성 사용


다음 코드를 실행하여 사용할 수 있습니다. 최대 너비 비디오 플레이어를 반응형으로 만드는 속성 −

예시

<!DOCTYPE html>
<html>
   <head>
      <meta name = "viewport" content = "width=device-width, initial-scale = 1.0">
      <style>
         video {
            max-width: 100%;
            height: auto;
         }
      </style>
   </head>
   <body>
      <video width = "300" controls autoplay>
         <source src = "/html5/foo.ogg" type = "video/ogg" />
         <source src = "/html5/foo.mp4" type = "video/mp4" />
      </video>
      <p>To check the effect, you need to resize the browser.</p>
   </body>
</html>