个性化阅读
专注于IT技术分析

Materialise CSS媒体

Materialize CSS Media指定了几个类来使图像和视频响应不同的大小。

响应式img:用于使图像根据屏幕尺寸调整大小。

video-container:用于具有嵌入式视频的响应式容器。

响应视频:用于使HTML5视频具有响应能力。

例子

让我们以一个示例在Materialize CSS Media中演示图像, 嵌入式视频和自适应视频为例。

<!DOCTYPE html>
<html>
   <head>
      <title>The Materialize CSS Example</title>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">      
      <link rel = "stylesheet"
         href = "https://fonts.googleapis.com/icon?family=Material+Icons">
      <link rel = "stylesheet"
         href = "https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css">
      <script type = "text/javascript"
         src = "https://code.jquery.com/jquery-2.1.1.min.js"></script>           
      <script src = "https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js">
      </script>             
   </head>
   
   <body class = "container"> 
      <h2>Materialize CSS Media Examples</h2>
      
      <hr/>
      <h3>Images Demo</h3>
      <div class = "card-panel">
<img src="https://www.srcmini02.com/oprweb/good-morning.jpg" alt="Good Morning Friends"/>  	
      </div>
      
      <div class = "card-panel">
<img src="https://www.srcmini02.com/oprweb/good-morning.jpg" alt="Good Morning Friends"/>  	 
      </div>

      <h3>Responsive Embeded Video Demo</h3>
      <div class = "video-container">
         <iframe width = "540" height = "200"
            src = "https://www.youtube.com/embed/Q8TXgCzxEnw?rel=0"
            frameborder = "0" allowfullscreen></iframe>
      </div>
      
      <div class = "video-container">
         <video  width = "300" height = "200" controls>
            <source src = "movie.mp4" type = "video/mp4" />
            Your browser does not support the video element.
         </video>
      </div>
   </body>
</html>

立即测试

赞(0)
未经允许不得转载:srcmini » Materialise CSS媒体

评论 抢沙发

评论前必须登录!