Getting started with materializecss
Remarks#
MaterializeCSS is a CSS and Javascript based front-end responsive framework, derived from Google’s Material Design. It is based entirely on Google’s Material Design guidelines and serves as a boilerplate in order to use material design in a better and fast way. It has some predefined plugins such as Scrollspy, Scrollfire, lightbox, parallax and much more.
Versions#
Version | Release Date |
---|---|
0.93.0 | 2014-12-19 |
0.94.0 | 2015-12-30 |
0.95.0 | 2015-01-17 |
0.96.0 | 2015-04-01 |
0.97.0 | 2015-07-02 |
0.97.7 | 2016-07-23 |
0.97.8 | 2016-10-30 |
0.98.0 | 2017-01-25 |
0.98.1 | 2017-03-21 |
Download
There are two ways to use MaterializeCSS, either you can download the files on your system or use the files from CDN (Content Delivery Network).
Download files
- Download the Materialize Package.
- Download the Materialize SASS Package.
- Install via NPM:
npm install materialize-css
- Install via Bower:
bower install materialize
Include From CDN
-
Include minifed CSS in the head section:
<!-- Compiled and minified CSS --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/css/materialize.min.css">
-
Include Javascript file in the Body section, just before the closing body tag.
<!-- Compiled and minified JavaScript --> <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/js/materialize.min.js"></script>
Setup
Once you’ve downloaded the files, extract your them into your designated directory.
You’ll notice that there are two sets of the files. The min
means that the file is “compressed” to reduce load times. These minified files are usually used in production while it is better to use the unminified files during development.
After extracting, your directory’s file structure should look like:
MyWebsite/
|--css/
| |--materialize.css
|
|--fonts/
| |--roboto/
|
|--js/
| |--materialize.js
|
|--index.html
Example MaterializeCSS HTML page:
<!DOCTYPE html>
<html>
<head>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Import materialize.css-->
<link type="text/css" rel="stylesheet" href="css/materialize.min.css" media="screen,projection"/>
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body>
<!--Import jQuery before materialize.js-->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="js/materialize.min.js"></script>
</body>
</html>
Templates
These are the simplest starter pages with a Header, Call-to-Action, and Icon Features.
Starter Template | Parallax Template |
---|---|
Demo or Download | Demo or Download |
Web Page Using Materializecss
Here is an example of a basic page using the Materialize CSS framework which incorporates the grid system and materialboxed
.
<!DOCTYPE html>
<html>
<head>
<title>Materializecss Example webpage</title>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Import materialize.css-->
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/css/materialize.min.css" media="screen,projection"/>
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body>
<div class="container">
<div class="row">
<div class="col s12"><h3>MATERIALIZECSS EXAMPLE</h3><h4>A simple website just to show how an element is used.</h4></div>
<div class="col s12 m6 l3">
<img class="materialboxed" width="100%" height="220" src="https://upload.wikimedia.org/wikipedia/commons/7/76/Katun_nature_reserve.jpg">
<h4>Katun Nature Reserve</h4>
<p><i>Lovely Place</i></p>
</div>
<div class="col s12 m6 l3">
<img class="materialboxed" width="100%" height="220" src="https://upload.wikimedia.org/wikipedia/commons/4/4b/Computer_art_4.png">
<h4>Art</h4>
<p><i>Simple & Attractive</i></p>
</div>
<div class="col s12 m6 l3">
<img class="materialboxed" width="100%" height="220" src="https://c1.staticflickr.com/9/8715/16947318656_4c6cbc3091_b.jpg">
<h4>Food</h4>
<p><i>For any occasion</i></p>
</div>
<div class="col s12 m6 l3">
<img class="materialboxed" width="100%" height="220" src="https://c1.staticflickr.com/7/6179/6217102314_350be5e843.jpg">
<h4>Steve Jobs</h4>
<p><i>Inspiration</i></p>
</div>
<div class="col s12"><h5>Comment your suggestion</h5></div>
</div>
</div>
<!--Import jQuery before materialize.js-->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/js/materialize.min.js"></script>
<script>
$(document).ready(function(){
$('.materialboxed').materialbox();
});
</script>
</body>