Materialize CSS provides different types of special classes to display containers as paper-like cards with shadow. These shadows make texts and images more appealing.
Index | Class name | Description |
---|---|---|
1) | z-depth-0 | It is used to remove the shadow of elements having z-depth by default. |
2) | z-depth-1 | It is used to style a container for any html content with 1px bordered shadow. adds z-depth of 1. |
3) | z-depth-2 | It is used to style a container for any html content with 2px bordered shadow. adds z-depth of 2. |
4) | z-depth-3 | It is used to style a container for any html content with 3px bordered shadow. adds z-depth of 3. |
5) | z-depth-4 | It is used to style a container for any html content with 4px bordered shadow. adds z-depth of 4. |
6) | z-depth-5 | It is used to style a container for any html content with 5px bordered shadow. adds z-depth of 5. |
Example
Let’s take an example to demonstrate the Materialize CSS shadow.
<!DOCTYPE html>
<html>
<head>
<title>The Materialize 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>
<style>
div {
width : 200px;
height : 200px;
}
</style>
</head>
<body class = "container">
<h2>Materialize CSS Shadow</h2>
<hr/>
<div class = "card-panel">
<p><b>Block1:</b> Learn Materialize CSS</p>
</div>
<div class = "z-depth-1">
<p><b>Block2:</b> Learn Materialize CSS</p>
</div>
<div class = "z-depth-2">
<p><b>Block3:</b> Learn Materialize CSS</p>
</div>
<div class = "z-depth-3">
<p><b>Block3:</b> Learn Materialize CSS</p>
</div>
<div class = "z-depth-4">
<p><b>Block4:</b> Learn Materialize CSS5</p>
</div>
<div class = "z-depth-5">
<p><b>Block4:</b> Learn Materialize CSS</p>
</div>
</body>
</html>
Output:
Leave a Reply