Skip to main content

Introduction

Get started with Material, a cross-platform and fully responsive front-end interface based on Google Material Design, built using Bootstrap 4.

Contents

Precompiled code

The Material precompiled code download includes the following:

daemonite-material/
├── css/
│   ├── material.css
│   ├── material.css.map
│   ├── material.min.css
│   |── material.min.css.map
|   ├── material-plugins.css
|   ├── material-plugins.css.map
|   ├── material-plugins.min.css
|   ├── material-plugins.min.css.map
└── js/
    ├── material.js
    ├── material.js.map
    ├── material.min.js
    └── material.min.js.map

This is the most basic form of Material: precompiled files for quick drop-in usage in nearly any web project.

We provide compiled CSS and JavaScript (material.*), as well as compiled and minified CSS and JavaScript (material.min.*).
Extra CSS for plugins is stored in (material-plugins.css) and minified in (material-plugins.min.css). Respective JavaScript for each plugin has to be imported manually (refer to Plugins section).

Check the starter template for a basic set up guide.

Source code

The Material source code download includes the precompiled CSS and JavaScript, along with documentation and source assets. More specifically, it includes the following and more:

daemonite-material/
├── assets/
│   ├── js/
│   └── scss/
├── css/
├── docs/
│   └── 4.5/
└── js/

The assets/ is the source code for our CSS and JavaScript.
The css/ and js/ folders are the same in the precompiled download section above.
The docs/ folder includes the source code for our documentation. Beyond that, any other included file provides support for development.

Check the theming guide for how to customise Material for your project using our source code.

Important globals

Material employs a handful of important global styles and settings that you’ll need to be aware of when using it, all of which are almost exclusively geared towards the normalization of cross browser styles. Let’s dive in.

Box-sizing

For more straightforward sizing in CSS, we switch the global box-sizing value from content-box to border-box. This ensures padding does not affect the final computed width of an element, but it can cause problems with some third party software like Google Maps.

On the rare occasion you need to override it, use something like the following:

.selector-for-some-widget {
  box-sizing: content-box;
}

With the above snippet, nested elements—including generated content via :before and :after will all inherit the specified box-sizing for that .selector-for-some-widget.

Learn more about box model and sizing at CSS Tricks.

HTML5 doctype

Material requires the use of the HTML5 doctype. Without it, you’ll see some funky incomplete styling, but including it shouldn’t cause any considerable hiccups.

<!DOCTYPE html>
<html lang="en">
  ...
</html>

Responsive meta tag

Material is developed mobile first, a strategy in which we optimize code for mobile devices first and then scale up components as necessary using CSS media queries. To ensure proper rendering and touch zooming for all devices, add the responsive viewport meta tag to your <head>.

<meta content="initial-scale=1, shrink-to-fit=no, width=device-width" name="viewport">

Starter template

Be sure to have your pages set up with the latest design and development standards. That means using an HTML5 doctype and including a viewport meta tag for proper responsive behaviors. Put it all together and your pages should look like this:

<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Add Material font (Roboto) and Material icon as needed -->
    <link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>
    <link rel="preconnect" href="https://cdn.jsdelivr.net/" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300;400;700&family=Roboto+Slab:wght@300;400;700&family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap" rel="stylesheet" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Material+Icons" rel="stylesheet" crossorigin>

    <!-- Material CSS -->
    <link href="https://cdn.jsdelivr.net/gh/djibe/material@4.5.3-rc3/css/material.min.css" rel="stylesheet" crossorigin>

    <!-- Optional Material CSS for Plugins
    <link href="https://cdn.jsdelivr.net/gh/djibe/material@4.5.3-rc3/css/material-plugins.min.css" rel="stylesheet" crossorigin>
    -->

    <title>Hello, world!</title>
  </head>
  <body>
    <h1>Hello, world!</h1>

    <!-- jQuery, Bootstrap Bundle (includes Popper) and Material -->
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha256-4+XzXVhsDmqanXGHaHvgh1gMQKX40OUvDEBTu8JcmNs=" crossorigin></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha256-jXCJJT3KKcnNjZ3rfsabCj1EX4j2omR4xxm+H5CtywE=" crossorigin></script>
    <script src="https://cdn.jsdelivr.net/gh/djibe/material@4.5.3-rc3/js/material.min.js" crossorigin async></script>
  </body>
</html>

That’s all you need for overall page requirements.