div響應式等比縮放實現

來源:互聯網
上載者:User

標籤:class   link   sheet   z-index   over   absolute   ade   rem   jquery   

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>響應式 div等比縮放</title>
<link rel="stylesheet" href="materialize.css">
<script src="jquery.min.js"></script>
<script src="materialize.min.js"></script>
</head>
<body>
<div class="row">
<div class="col s12 m6 l4">
<ul data-collapsible="accordion" style="width:100%;box-shadow:none;" class="collapsible">
<li style="width:100%;">
<div style="position:relative;text-align:center;width:100%;height:0;padding-bottom:100% !important;"
class="collapsible-header">
<div style="position:absolute;bottom:30px;left:50%;z-index:10;margin-left:-30px;width:60px;height:24px;color:#333;text-align:center;">
查看詳情
</div>
<div
style="position:absolute;left:0;bottom:0;width:100%;height:100%;padding:30%;padding-top:25%;overflow:hidden;">
<img src="aaa.svg" class="responsive-img"></div>
</div>
<div style="padding:6px;" class="collapsible-body">
<div style="height:2rem;line-height:2rem;"><span>文字</span></div>
<hr>
<div style="height:184px;overflow:scroll;"><p>文字文字文字...</p></div>
</div>
</li>
</ul>
</div>
</div>
</html>

 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

說明:materialize是與bootstrap一樣的響應式架構,依賴jquery。

圖1,(頁面寬度1100px,div占頁寬1/3)

圖2,(頁面寬度1100px,div占頁寬1/2)

圖3,(頁面寬度500px,div占頁寬1/1)

 

div響應式等比縮放實現

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.