Materialize 卡片
2018-01-05 13:33 更新
Materialise提供了各种CSS类,以对显示各种类型的卡应用各种预定义的视觉和行为增强。下表提到了可用的类及其效果。
SN | 类名称及说明 |
---|---|
1 | card 将div元素标识为Materialize卡容器。在“outer”div上需要。 |
2 | card-content 将div标识为卡内容容器,并且在“inner”div上是必需的。 |
3 | card-title 将div标识为卡片标题容器,并且在“inner”标题div上是必需的。 |
4 | card-action 将div标识为卡操作容器,并为操作文本分配适当的文本特性,并在“内部”操作div上需要;内容直接在div内部,没有中间容器。 |
5 | card-image 将div标识为卡片图像容器,并且在“内部”div上是必需的。 |
6 | card-reveal 将div标识为显示的文本容器。 |
7 | activator 将div标识为显示的文本容器,将图像标识为显示器。用于显示与图像相关的上下文信息。 |
8 | card-panel 将div标识为具有阴影和填充的简单卡。 |
9 | card-small 将div标识为小型卡。身高:300px; |
10 | card-medium 将div标识为中型卡。高度:400px; |
11 | card-large 将div标识为大型卡。身高:500px; |
以下示例展示使用卡类来展示各种类型的卡。
materialize_cards.html
<!DOCTYPE html> <html> <head> <title>The Materialize Cards 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="/attachments/tuploads/materialize/jquery-2.1.1.min.js"></script> <script src="/attachments/tuploads/materialize/materialize.min.js"></script> </head> <body class="container"> <div class="row"> <div class="col s12 m6"> <div class="card blue-grey lighten-4"> <div class="card-content"> <span class="card-title"><h3>Learn HTML5</h3></span> <p>HTML5 is the next major revision of the HTML standard superseding HTML 4.01, XHTML 1.0, and XHTML 1.1. HTML5 is a standard for structuring and presenting content on the World Wide Web.</p> </div> <div class="card-action"> <button class="btn waves-effect waves-light blue-grey"><i class="material-icons">share</i></button> <a class="right blue-grey-text" href="http://www.w3cschool.cn">www.w3cschool.cn</a> </div> </div> </div> <div class="col s12 m6"> <div class="card blue-grey lighten-4"> <div class="card-image"> <img src="html5-mini-logo.jpg"> </div> <div class="card-content"> <p>HTML5 is the next major revision of the HTML standard superseding HTML 4.01, XHTML 1.0, and XHTML 1.1. HTML5 is a standard for structuring and presenting content on the World Wide Web.</p> </div> <div class="card-action"> <button class="btn waves-effect waves-light blue-grey"><i class="material-icons">share</i></button> <a class="right blue-grey-text" href="http://www.w3cschool.cn">www.w3cschool.cn</a> </div> </div> </div> </div> <div class="row"> <div class="col s12 m6"> <div class="card blue-grey lighten-4"> <div class="card-image waves-effect waves-block waves-light"> <img class="activator" src="html5-mini-logo.jpg"> </div> <div class="card-content activator"> <p>Click the image to reveal more information.</p> </div> <div class="card-reveal"> <span class="card-title grey-text text-darken-4">HTML5<i class="material-icons right">close</i></span> <p>HTML5 is the next major revision of the HTML standard superseding HTML 4.01, XHTML 1.0, and XHTML 1.1. HTML5 is a standard for structuring and presenting content on the World Wide Web.</p> </div> <div class="card-action"> <button class="btn waves-effect waves-light blue-grey"><i class="material-icons">share</i></button> <a class="right blue-grey-text" href="http://www.w3cschool.cn">www.w3cschool.cn</a> </div> </div> </div> </div> <div class="row"> <div class="col s12 m3"> <div class="card-panel teal"> <span class="white-text">Simple Card</span> </div> </div> <div class="col s12 m3"> <div class="card small teal"> <span class="white-text">Small Card</span> </div> </div> <div class="col s12 m3"> <div class="card medium teal"> <span class="white-text">Medium Card</span> </div> </div> <div class="col s12 m3"> <div class="card large teal"> <span class="white-text">Large Card</span> </div> </div> </div> </body> </html>
结果
验证结果,如下图所示。
以上内容是否对您有帮助:
更多建议: