materialize provides different css classes to apply various predefined visual and behavioral enhancements to display various types of cards. following table mentions the available classes and their effects.
sr.no. | class name & description |
---|---|
1 |
card identifies div element as a materialize card container. required on "outer" div. |
2 |
card-content identifies div as a card content container and is required on "inner" div. |
3 |
card-title identifies div as a card title container and is required on "inner" title div. |
4 |
card-action identifies div as a card actions container and assigns appropriate text characteristics to actions text. required on "inner" actions div; content goes directly inside the div with no intervening containers. |
5 |
card-image identifies div as a card image container and is required on "inner" div. |
6 |
card-reveal identifies div as a revealed text container. |
7 |
activator identifies div as a revealed text container and image to be revealer. used to show contextual information related to image. |
8 |
card-panel identifies div as a simple card with shadows and padding. |
9 |
card-small identifies div as a small sized card. height − 300px; |
10 |
card-medium identifies div as a medium sized card. height − 400px; |
11 |
card-larger identifies div as a large sized card. height − 500px; |
example
the following example showcases the use of card classes to showcase various types of cards.
<!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="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"> <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.tutorialspoint.com">www.tutorialspoint.com</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.tutorialspoint.com">www.tutorialspoint.com</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.tutorialspoint.com">www.tutorialspoint.com</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>
output
verify the output.

