MDL – Layouts

Material Design Lite – Layouts ”; Previous Next In this chapter, we will discuss the different layouts in Material Design Lite. HTML5 has the following container elements − <div> − Provides a generic container to HTML content. <header> − Represents the header section. <footer> − Represents the footer section. <article> − Represents articles. <section> − Provides a generic container for various types of sections. MDL provides various CSS classes to apply various predefined visual and behavioral enhancements to the containers. The following table lists down the available classes and their effects. Sr.No. Class Name & Description 1 mdl-layout Identifies a container as an MDL component. Required on outer container element. 2 mdl-js-layout Adds basic MDL behavior to layout. Required on outer container element. 3 mdl-layout__header Identifies container as an MDL component. Required on header element. 4 mdl-layout-icon Used to add an application icon. Gets overridden by menu icon if both are visible. Optional icon element. 5 mdl-layout__header-row Identifies container as MDL header row. Required on header content container. 6 mdl-layout__title Identifies layout title text. Required on layout title container. 7 mdl-layout-spacer Used to align elements inside a header or drawer. It grows to fill remaining space. Commonly used for aligning elements to the right. Optional on div following layout title. 8 mdl-navigation Identifies container as MDL navigation group. Required on nav element. 9 mdl-navigation__link Identifies anchor as MDL navigation link. Required on header and/or drawer anchor elements. 10 mdl-layout__drawer Identifies container as MDL layout drawer. Required on drawer container element. 11 mdl-layout__content Identifies container as MDL layout content. Required on main element. 12 mdl-layout__header–scroll Makes the header scroll with the content. Optional on header element. 13 mdl-layout–fixed-drawer Makes the drawer always visible and open in larger screens. Optional on outer container element and not on drawer container element. 14 mdl-layout–fixed-header Makes the header always visible, even in small screens. Optional on outer container element. 15 mdl-layout–large-screen-only Hides an element on smaller screens. Optional on any descendant of mdl-layout. 16 mdl-layout–small-screen-only Hides an element on larger screens. Optional on any descendant of mdl-layout. 17 mdl-layout__header–waterfall Allows a “waterfall” effect with multiple header lines. Optional on header element. 18 mdl-layout__header–transparent Makes header transparent and draws on top of layout background. Optional on header element. 19 mdl-layout__header–seamed Uses a header without a shadow. Optional on header element. 20 mdl-layout__tab-bar Identifies container as an MDL tab bar. Required on container element inside header (tabbed layout). 21 mdl-layout__tab Identifies anchor as MDL tab link. Required on tab bar anchor elements. 22 is-active Identifies tab as default active tab. Optional on tab bar anchor element and associated tab section element. 23 mdl-layout__tab-panel Identifies container as tab content panel. Required on tab section elements. 24 mdl-layout–fixed-tabs Uses fixed tabs instead of the default scrollable tabs. Optional on outer container element , not container inside header. The following examples show the use of mdl-layout class to style various containers. Fixed Drawer To create a template with fixed drawer but no header, the following MDL classes are used. mdl-layout − Identifies a div as an MDL component. mdl-js-layout − Adds basic MDL behavior to outer div. mdl-layout–fixed-drawer − Makes the drawer always visible and open in larger screens. mdl-layout__drawer − Identifies div as MDL layout drawer. mdl-layout-title − Identifies layout title text. mdl-navigation − Identifies div as MDL navigation group. mdl-navigation__link − Identifies anchor as MDL navigation link. mdl-layout__content − Identifies div as MDL layout content. mdl_fixeddrawer.htm Live Demo <html> <head> <link rel = “stylesheet” href = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.indigo-pink.min.css”> <script src = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.min.js”> </script> <link rel = “stylesheet” href = “https://fonts.googleapis.com/icon?family=Material+Icons”> </head> <body> <!– No header, and the drawer stays open on larger screens (fixed drawer).–> <div class = “mdl-layout mdl-js-layout mdl-layout–fixed-drawer”> <div class = “mdl-layout__drawer”> <span class = “mdl-layout-title”>HTML5 Tutorial</span> <nav class = “mdl-navigation”> <a class = “mdl-navigation__link” href = “”>Home</a> <a class = “mdl-navigation__link” href = “”>About</a> </nav> </div> <main class = “mdl-layout__content”> <div class = “page-content” style = “padding-left:100px;”>Hello World!</div> </main> </div> </body> </html> Result Verify the result. Fixed Header To create a template with fixed header following additional MDL class is used. mdl-layout–fixed-header − Makes the header always visible, even in small screens. mdl_fixedheader.htm Live Demo <html> <head> <link rel = “stylesheet” href = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.indigo-pink.min.css”> <script src = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.min.js”> </script> <link rel = “stylesheet” href = “https://fonts.googleapis.com/icon?family=Material+Icons”> </head> <body> <!– Always shows a header, even in smaller screens. –> <div class = “mdl-layout mdl-js-layout mdl-layout–fixed-header”> <header class = “mdl-layout__header”> <div class = “mdl-layout__header-row”> <!– Title –> <span class = “mdl-layout-title”>HTML5 Tutorial</span> <!– Add spacer, to align navigation to the right –> <div class = “mdl-layout-spacer”></div> <!– Navigation –> <nav class = “mdl-navigation”> <a class = “mdl-navigation__link” href = “” style = “color:gray”>Home</a> <a class = “mdl-navigation__link” href = “” style = “color:gray”>About</a> </nav> </div> </header> <div class = “mdl-layout__drawer”> <span class = “mdl-layout-title”>HTML5 Tutorial</span> <nav class = “mdl-navigation”> <a class = “mdl-navigation__link” href = “”>Home</a> <a class = “mdl-navigation__link” href = “”>About</a> </nav> </div> <main class = “mdl-layout__content”> <div class = “page-content”>Hello World!</div> </main> </div> </body> </html> Result Verify the result. Fixed Header and Drawer To create a template with fixed header and a fixed drawer, following additional MDL classes are used. mdl-layout–fixed-drawer − Makes the drawer always visible and open in larger screens. mdl-layout–fixed-header − Makes the header always visible, even in small screens. mdl_fixedheader.htm Live Demo <html> <head> <link rel = “stylesheet” href = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.indigo-pink.min.css”> <script src = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.min.js”> </script> <link rel = “stylesheet” href = “https://fonts.googleapis.com/icon?family=Material+Icons”> </head> <body> <!– The drawer is always open in large screens. The header is always shown, even in small screens. –> <div class = “mdl-layout mdl-js-layout mdl-layout–fixed-drawer mdl-layout–fixed-header”> <header class = “mdl-layout__header”> <div class = “mdl-layout__header-row”> <!– Title –> <span class = “mdl-layout-title”>HTML5 Tutorial</span> <!– Add spacer, to align navigation to the right –> <div class = “mdl-layout-spacer”></div> <!– Navigation –> <nav class = “mdl-navigation”> <a class = “mdl-navigation__link” href = “” style = “color:gray”>Home</a> <a class = “mdl-navigation__link” href = “” style = “color:gray”>About</a> </nav> </div> </header> <div class = “mdl-layout__drawer”> <span

MDL – Overview

Material Design Lite – Overview ”; Previous Next What is Material Design Lite? Material Design Lite (MDL is a UI component library created with CSS, JavaScript, and HTML. The MDL UI components help in constructing attractive, consistent, and functional web pages and web apps while adhering to modern web design principles like browser portability, device independence, and graceful degradation. Following are the salient features of Material Design Lite − In-built responsive designing. Standard CSS with minimal footprint. Includes new versions of common user interface controls such as buttons, check boxes, and text fields which are adapted to follow Material Design concepts. Includes enhanced and specialized features like cards, column layouts, sliders, spinners, tabs, typography, and so on. Can be used with or without any library or development environment. Cross-browser, and can be used to create reusable web components. Responsive Design Material Design Lite has in-built responsive designing so that the website created using Material Design Lite will redesign itself as per the device size. Material Design Lite classes are created in such a way that the website can fit any screen size. The websites created using Material Design Lite are fully compatible with PC, tablets, and mobile devices. Standard CSS Material Design Lite uses standard CSS only and it is very easy to learn. There is no dependency on any external JavaScript library such as jQuery. ExtensibleMaterial Design Lite is by design very minimal and flat. It is designed considering the fact that it is much easier to add new CSS rules than to overwrite existing CSS rules. It supports shadows and bold colors. The colors and shades remain uniform across various platforms and devices. And most important of all, MDL is absolutely free to use. Print Page Previous Next Advertisements ”;

MDL – Badges

Material Design Lite – Badges ”; Previous Next An MDL badge component is an onscreen notification which can be a number or an icon. It is generally used to emphasize the number of items. MDL provides a range of CSS classes to apply various predefined visual and behavioral enhancements to the badges. The following table lists down the available classes and their effects. Sr.No. Class Name & Description 1 mdl-badge Identifies element as an MDL badge component. Required for span or link element. 2 mdl-badge–no-background Applies open-circle effect to badge and is optional. 3 mdl-badge–overlap Makes the badge overlap with its container and is optional. 4 data-badge=”value” Assigns a string value to badge used as attribute; required on span or link. Example The following example will help you understand the use of the mdl-badge class to add notifications to span and link elements. The MDL classes given below will be used in this example. mdl-badge − Identifies element as an MDL badge component. data-badge − Assigns a string value to badge. Icons can be assigned to it using HTML symbols. mdl_badges.htm Live Demo <html> <head> <script src = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.min.js”> </script> <link rel = “stylesheet” href = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.indigo-pink.min.css”> <link rel = “stylesheet” href = “https://fonts.googleapis.com/icon?family=Material+Icons”> <style> body { padding: 20px; background: #fafafa; position: relative; } </style> </head> <body> <span class = “material-icons mdl-badge” data-badge = “1”>account_box</span> <span class = “material-icons mdl-badge” data-badge = “★”>account_box</span> <span class = “mdl-badge” data-badge = “4”>Unread Messages</span> <span class = “mdl-badge” data-badge = “⚑”>Rating</span> <a href = “#” class = “mdl-badge” data-badge = “5”>Inbox</a> </body> </html> Result Verify the result. Print Page Previous Next Advertisements ”;

MDL – Footers

Material Design Lite – Footers ”; Previous Next An MDL footer component comes in two primary forms: mega-footer and mini-footer. mega-footer contains more complex content than mini-footer. A mega-footer can represent multiple sections of content which are separated by horizontal rules, whereas a mini-footer presents a single section of content. The footers typically contain both informational and clickable content, such as links. MDL provides various CSS classes to apply various predefined visual and behavioral enhancements to the mega-footer and mini-footer. The following table lists down the available classes and their effects. Sr.No. Class Name & Description 1 mdl-mega-footer Identifies container as an MDL mega-footer component. Required for footer element. 2 mdl-mega-footer__top-section Identifies container as a footer top section. Required for top section “outer” div element. 3 mdl-mega-footer__left-section Identifies container as a left section. Required for left section “inner” div element. 4 mdl-mega-footer__social-btn Identifies a decorative square within mega-footer. Required for button element (if used). 5 mdl-mega-footer__right-section Identifies container as a right section. Required for right section “inner” div element. 6 mdl-mega-footer__middle-section Identifies container as a footer middle section. Required for middle section “outer” div element. 7 mdl-mega-footer__drop-down-section Identifies container as a drop-down (vertical) content area. Required for drop-down “inner” div elements. 8 mdl-mega-footer__heading Identifies a heading as a mega-footer heading. Required for h1 element inside drop-down section. 9 mdl-mega-footer__link-list Identifies an unordered list as a drop-down (vertical) list. Required for ul element inside drop-down section. 10 mdl-mega-footer__bottom-section Identifies container as a footer bottom section. Required for bottom section “outer” div element. 11 mdl-logo Identifies a container as a styled section heading. Required for “inner” div element in mega-footer bottom-section or mini-footer left-section. 12 mdl-mini-footer Identifies container as an MDL mini-footer component. Required for footer element. 13 mdl-mini-footer__left-section Identifies container as a left section. Required for left section “inner” div element. 14 mdl-mini-footer__link-list Identifies an unordered list as an inline (horizontal) list. Required for ul element sibling to “mdl-logo” div element. 15 mdl-mini-footer__right-section Identifies container as a right section. Required for right section “inner” div element. 16 mdl-mini-footer__social-btn Identifies a decorative square within mini-footer. Required for button element (if used). Now, let us see a few examples to understand the use of MDL footer classes to style footers. Mega Footer Let us discuss the use of the mdl-mega-footer class to layout contents in a footer. The following MDL classes will be used in this example. mdl-layout − Identifies a div as an MDL component. mdl-js-layout − Adds basic MDL behavior to outer div. mdl-layout–fixed-header − Makes the header always visible, even in small screens. mdl-layout__header-row − Identifies container as MDL header row. mdl-layout-title − Identifies layout title text. mdl-layout__content − Identifies div as MDL layout content. mdl-mega-footer − Identifies container as an MDL mega-footer component. mdl-mega-footer__top-section − Identifies container as a footer top section. mdl-mega-footer__left-section − Identifies container as a left section. mdl-mega-footer__social-btn − Identifies a decorative square within mini-footer. mdl-mega-footer__right-section − Identifies container as a right section. mdl-mega-footer__middle-section − Identifies container as a footer middle section. mdl-mega-footer__drop-down-section − Identifies container as a drop-down (vertical) content area. mdl-mega-footer__heading − Identifies a heading as a mega-footer heading. mdl-mega-footer__link-list − Identifies an unordered list as an inline (horizontal) list. mdl-mega-footer__bottom-section − Identifies container as a footer bottom section. mdl-logo − Identifies a container as a styled section heading. mdl_megafooter.htm Live Demo <html> <head> <link rel = “stylesheet” href = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.indigo-pink.min.css”> <script src = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.min.js”> </script> <link rel = “stylesheet” href = “https://fonts.googleapis.com/icon?family=Material+Icons”> </head> <body> <div class = “mdl-layout mdl-js-layout mdl-layout–fixed-header”> <header class = “mdl-layout__header”> <div class = “mdl-layout__header-row”> <span class = “mdl-layout-title”>Material Design Tabs</span> </div> </header> <main class = “mdl-layout__content”> <footer class = “mdl-mega-footer”> <div class = “mdl-mega-footer__top-section”> <div class = “mdl-mega-footer__left-section”> <button class = “mdl-mega-footer__social-btn”>1</button> <button class = “mdl-mega-footer__social-btn”>2</button> <button class = “mdl-mega-footer__social-btn”>3</button> </div> <div class = “mdl-mega-footer__right-section”> <a href = “”>Link 1</a> <a href = “”>Link 2</a> <a href = “”>Link 3</a> </div> </div> <div class = “mdl-mega-footer__middle-section”> <div class = “mdl-mega-footer__drop-down-section”> <h1 class = “mdl-mega-footer__heading”>Heading </h1> <ul class = “mdl-mega-footer__link-list”> <li><a href = “”>Link A</a></li> <li><a href = “”>Link B</a></li> </ul> </div> <div class = “mdl-mega-footer__drop-down-section”> <h1 class = “mdl-mega-footer__heading”>Heading </h1> <ul class = “mdl-mega-footer__link-list”> <li><a href = “”>Link C</a></li> <li><a href = “”>Link D</a></li> </ul> </div> </div> <div class = “mdl-mega-footer__bottom-section”> <div class = “mdl-logo”> Bottom Section </div> <ul class = “mdl-mega-footer__link-list”> <li><a href = “”>Link A</a></li> <li><a href = “”>Link B</a></li> </ul> </div> </footer> </main> </div> </body> </html> Result Verify the result. Mini Footer The following example will help you understand the use of the mdl-mini-footer class to layout contents in a footer. The MDL classes given below will be used in this example. mdl-layout − Identifies a div as an MDL component. mdl-js-layout − Adds basic MDL behavior to outer div. mdl-layout–fixed-header − Makes the header always visible, even in small screens. mdl-layout__header-row − Identifies container as MDL header row. mdl-layout-title − Identifies layout title text. mdl-layout__content − Identifies div as MDL layout content. mdl-mini-footer − Identifies container as an MDL mini-footer component. mdl-mini-footer__left-section − Identifies container as a left section. mdl-logo – Identifies a container as a styled section heading. mdl-mini-footer__link-list − Identifies an unordered list as an inline (horizontal) list. mdl-mini-footer__right-section − Identifies container as a right section. mdl_minifooter.htm Live Demo <html> <head> <link rel = “stylesheet” href = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.indigo-pink.min.css”> <script src = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.min.js”> </script> <link rel = “stylesheet” href = “https://fonts.googleapis.com/icon?family=Material+Icons”> </head> <body> <div class = “mdl-layout mdl-js-layout mdl-layout–fixed-header”> <header class = “mdl-layout__header”> <div class = “mdl-layout__header-row”> <span class = “mdl-layout-title”>Material Design Tabs</span> </div> </header> <main class = “mdl-layout__content”> <footer class = “mdl-mini-footer”> <div class = “mdl-mini-footer__left-section”> <div class = “mdl-logo”> Copyright Information </div> <ul class = “mdl-mini-footer__link-list”> <li><a href = “#”>Help</a></li> <li><a href = “#”>Privacy and Terms</a></li> <li><a href = “#”>User Agreement</a></li> </ul> </div> <div class = “mdl-mini-footer__right-section”> <button class = “mdl-mini-footer__social-btn”>1</button> <button class = “mdl-mini-footer__social-btn”>2</button> <button class = “mdl-mini-footer__social-btn”>3</button> </div> </footer> </main> </div> </body> </html> Result Verify the result. Print Page Previous Next

MDL – Environment Setup

Material Design Lite – Environment Setup ”; Previous Next There are two ways to use Material Design Lite − Local Installation − You can download the material.{primary}-{accent}.min.css and material.min.js files on your local machine and include it in your HTML code. CDN Based Version − You can include the material.{primary}-{accent}.min.css and material.min.js files into your HTML code directly from the Content Delivery Network (CDN). Local Installation Follow these steps for the installation of MDL − Go to https://www.getmdl.io/started/index.html to download the latest version available. Then, put the downloaded material.min.js file in a directory of your website, e.g. /js and material.min.css in /css. Example Now you can include the css and js file in your HTML file as follows − Live Demo <html> <head> <title>The Material Design Lite Example</title> <meta name = “viewport” content = “width = device-width, initial-scale = 1”> <link rel = “stylesheet” href = “material.min.css”> <script src = “material.min.js”></script> <link rel = “stylesheet” href = “https://fonts.googleapis.com/icon?family=Material+Icons”> </head> <body> <div class = “mdl-layout mdl-js-layout mdl-layout–fixed-drawer”> <div class = “mdl-layout__drawer”> <span class = “mdl-layout-title”>Material Design</span> <nav class = “mdl-navigation”> <a class = “mdl-navigation__link” href = “”>Home</a> <a class = “mdl-navigation__link” href = “”>Features</a> <a class = “mdl-navigation__link” href = “”>About Us</a> <a class = “mdl-navigation__link” href = “”>Log Out</a> </nav> </div> <main class = “mdl-layout__content”> <div class = “page-content” style = “padding-left:100px;”>Hello World!</div> </main> </div> </body> </html> The above program will generate the following result − CDN Based Version You can include the js and css files into your HTML code directly from the Content Delivery Network (CDN). storage.googleapis.com provides content for the latest version. We are using storage.googleapis.com CDN version of the library throughout this tutorial. Example Now, let us rewrite the above example using material.css and material.js from the Google CDN. Live Demo <html> <head> <title>The Material Design Lite Example</title> <meta name = “viewport” content = “width = device-width, initial-scale = 1”> <link rel = “stylesheet” href = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.indigo-pink.min.css”> <script src = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.min.js”></script> <link rel = “stylesheet” href = “https://fonts.googleapis.com/icon?family=Material+Icons”> </head> <body> <div class = “mdl-layout mdl-js-layout mdl-layout–fixed-drawer”> <div class = “mdl-layout__drawer”> <span class = “mdl-layout-title”>Material Design</span> <nav class = “mdl-navigation”> <a class = “mdl-navigation__link” href = “”>Home</a> <a class = “mdl-navigation__link” href = “”>Features</a> <a class = “mdl-navigation__link” href = “”>About Us</a> <a class = “mdl-navigation__link” href = “”>Log Out</a> </nav> </div> <main class = “mdl-layout__content”> <div class = “page-content” style = “padding-left:100px;”>Hello World!</div> </main> </div> </body> </html> The above program will generate the following result − Print Page Previous Next Advertisements ”;

MDL – Progress Bars

Material Design Lite – Progress Bars ”; Previous Next MDL provides a range of CSS classes to apply various predefined visual and behavioral enhancements and display the different types of progress bars. The following table mentions the available classes and their effects. Sr.No. Class Name & Description 1 mdl-js-progress Sets basic MDL behavior to progress indicator and is a required class. 2 mdl-progress__indeterminate Sets animation to progress indicator and is an optional class. Example The following example will help you understand the use of the mdl-js-progress classes to show the different types of progress bars. mdl_progressbars.htm Live Demo <html> <head> <script src = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.min.js”> </script> <link rel = “stylesheet” href = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.indigo-pink.min.css”> <link rel = “stylesheet” href = “https://fonts.googleapis.com/icon?family=Material+Icons”> </head> <body> <h4>Default Progress bar</h4> <div id = “progressbar1” class = “mdl-progress mdl-js-progress”></div> <h4>Indeterminate Progress bar</h4> <div id = “progressbar2” class = “mdl-progress mdl-js-progress mdl-progress__indeterminate”></div> <h4>Buffering Progress bar</h4> <div id = “progressbar3” class = “mdl-progress mdl-js-progress”></div> <script language = “javascript”> document.querySelector(”#progressbar1”).addEventListener(”mdl-componentupgraded”, function() { this.MaterialProgress.setProgress(44); }); document.querySelector(”#progressbar3”).addEventListener(”mdl-componentupgraded”, function() { this.MaterialProgress.setProgress(33); this.MaterialProgress.setBuffer(87); }); </script> </body> </html> Result Verify the result. Print Page Previous Next Advertisements ”;

MDL – Useful Resources

Material Design Lite – Useful Resources ”; Previous Next The following resources contain additional information on Material Design Lite. Please use them to get more in-depth knowledge on this. Useful Video Courses E-commerce Web with Angular 8 (Material) and Firebase Featured 61 Lectures 5 hours University Code More Detail Android Material UI Design Masterclass with Adobe Xd 36 Lectures 6.5 hours Stevdza-San More Detail SAP MM (Materials Management) Training Best Seller 43 Lectures 33.5 hours Uplatz More Detail Energy and Material Balance-EA/EM Exam 5 Lectures 1 hours The GT Academy More Detail Vray Next MDL Material AEC 3ds max 129 Lectures 9.5 hours Marcello Pattarin More Detail Vendor Master and Material Master Customization in SAP MM 10 Lectures 49 mins Sumit Jain More Detail Print Page Previous Next Advertisements ”;

MDL – Quick Guide

Material Design Lite – Quick Guide ”; Previous Next Material Design Lite – Overview What is Material Design Lite? Material Design Lite (MDL is a UI component library created with CSS, JavaScript, and HTML. The MDL UI components help in constructing attractive, consistent, and functional web pages and web apps while adhering to modern web design principles like browser portability, device independence, and graceful degradation. Following are the salient features of Material Design Lite − In-built responsive designing. Standard CSS with minimal footprint. Includes new versions of common user interface controls such as buttons, check boxes, and text fields which are adapted to follow Material Design concepts. Includes enhanced and specialized features like cards, column layouts, sliders, spinners, tabs, typography, and so on. Can be used with or without any library or development environment. Cross-browser, and can be used to create reusable web components. Responsive Design Material Design Lite has in-built responsive designing so that the website created using Material Design Lite will redesign itself as per the device size. Material Design Lite classes are created in such a way that the website can fit any screen size. The websites created using Material Design Lite are fully compatible with PC, tablets, and mobile devices. Standard CSS Material Design Lite uses standard CSS only and it is very easy to learn. There is no dependency on any external JavaScript library such as jQuery. ExtensibleMaterial Design Lite is by design very minimal and flat. It is designed considering the fact that it is much easier to add new CSS rules than to overwrite existing CSS rules. It supports shadows and bold colors. The colors and shades remain uniform across various platforms and devices. And most important of all, MDL is absolutely free to use. Material Design Lite – Environment Setup There are two ways to use Material Design Lite − Local Installation − You can download the material.{primary}-{accent}.min.css and material.min.js files on your local machine and include it in your HTML code. CDN Based Version − You can include the material.{primary}-{accent}.min.css and material.min.js files into your HTML code directly from the Content Delivery Network (CDN). Local Installation Follow these steps for the installation of MDL − Go to https://www.getmdl.io/started/index.html to download the latest version available. Then, put the downloaded material.min.js file in a directory of your website, e.g. /js and material.min.css in /css. Example Now you can include the css and js file in your HTML file as follows − Live Demo <html> <head> <title>The Material Design Lite Example</title> <meta name = “viewport” content = “width = device-width, initial-scale = 1”> <link rel = “stylesheet” href = “material.min.css”> <script src = “material.min.js”></script> <link rel = “stylesheet” href = “https://fonts.googleapis.com/icon?family=Material+Icons”> </head> <body> <div class = “mdl-layout mdl-js-layout mdl-layout–fixed-drawer”> <div class = “mdl-layout__drawer”> <span class = “mdl-layout-title”>Material Design</span> <nav class = “mdl-navigation”> <a class = “mdl-navigation__link” href = “”>Home</a> <a class = “mdl-navigation__link” href = “”>Features</a> <a class = “mdl-navigation__link” href = “”>About Us</a> <a class = “mdl-navigation__link” href = “”>Log Out</a> </nav> </div> <main class = “mdl-layout__content”> <div class = “page-content” style = “padding-left:100px;”>Hello World!</div> </main> </div> </body> </html> The above program will generate the following result − CDN Based Version You can include the js and css files into your HTML code directly from the Content Delivery Network (CDN). storage.googleapis.com provides content for the latest version. We are using storage.googleapis.com CDN version of the library throughout this tutorial. Example Now, let us rewrite the above example using material.css and material.js from the Google CDN. Live Demo <html> <head> <title>The Material Design Lite Example</title> <meta name = “viewport” content = “width = device-width, initial-scale = 1”> <link rel = “stylesheet” href = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.indigo-pink.min.css”> <script src = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.min.js”></script> <link rel = “stylesheet” href = “https://fonts.googleapis.com/icon?family=Material+Icons”> </head> <body> <div class = “mdl-layout mdl-js-layout mdl-layout–fixed-drawer”> <div class = “mdl-layout__drawer”> <span class = “mdl-layout-title”>Material Design</span> <nav class = “mdl-navigation”> <a class = “mdl-navigation__link” href = “”>Home</a> <a class = “mdl-navigation__link” href = “”>Features</a> <a class = “mdl-navigation__link” href = “”>About Us</a> <a class = “mdl-navigation__link” href = “”>Log Out</a> </nav> </div> <main class = “mdl-layout__content”> <div class = “page-content” style = “padding-left:100px;”>Hello World!</div> </main> </div> </body> </html> The above program will generate the following result − Material Design Lite – Layouts In this chapter, we will discuss the different layouts in Material Design Lite. HTML5 has the following container elements − <div> − Provides a generic container to HTML content. <header> − Represents the header section. <footer> − Represents the footer section. <article> − Represents articles. <section> − Provides a generic container for various types of sections. MDL provides various CSS classes to apply various predefined visual and behavioral enhancements to the containers. The following table lists down the available classes and their effects. Sr.No. Class Name & Description 1 mdl-layout Identifies a container as an MDL component. Required on outer container element. 2 mdl-js-layout Adds basic MDL behavior to layout. Required on outer container element. 3 mdl-layout__header Identifies container as an MDL component. Required on header element. 4 mdl-layout-icon Used to add an application icon. Gets overridden by menu icon if both are visible. Optional icon element. 5 mdl-layout__header-row Identifies container as MDL header row. Required on header content container. 6 mdl-layout__title Identifies layout title text. Required on layout title container. 7 mdl-layout-spacer Used to align elements inside a header or drawer. It grows to fill remaining space. Commonly used for aligning elements to the right. Optional on div following layout title. 8 mdl-navigation Identifies container as MDL navigation group. Required on nav element. 9 mdl-navigation__link Identifies anchor as MDL navigation link. Required on header and/or drawer anchor elements. 10 mdl-layout__drawer Identifies container as MDL layout drawer. Required on drawer container element. 11 mdl-layout__content Identifies container as MDL layout content. Required on main element. 12 mdl-layout__header–scroll Makes the header scroll with the content. Optional on header element. 13 mdl-layout–fixed-drawer Makes the drawer always visible and open in larger screens. Optional on outer container element and not on drawer container element. 14 mdl-layout–fixed-header

MDL – Buttons

Material Design Lite – Buttons ”; Previous Next MDL provides a range of CSS classes to apply various predefined visual and behavioral enhancements to the buttons. The following table lists down the available classes and their effects. Sr.No. Class Name & Description 1 mdl-button Sets button as an MDL component, required. 2 mdl-js-button Adds basic MDL behavior to button, required. 3 (none) Sets flat display effect to button, default. 4 mdl-button–raised Sets raised display effect; this is mutually exclusive with fab, mini-fab, and icon. 5 mdl-button–fab Sets fab (circular) display effect; this is mutually exclusive with raised, mini-fab, and icon. 6 mdl-button–mini-fab Sets mini-fab (small fab circular) display effect; this is mutually exclusive with raised, fab, and icon. 7 mdl-button–icon Sets icon (small plain circular) display effect; this is mutually exclusive with raised, fab, and mini-fab. 8 mdl-button–colored Sets colored display effect where the colors are defined in material.min.css. 9 mdl-button–primary Sets primary color display effect where the colors are defined in material.min.css. 10 mdl-button–accent Sets accent color display effect where the colors are defined in material.min.css. 11 mdl-js-ripple-effect Sets ripple click effect, can be used in combination with any other class. Example The following example will help you understand the use of the mdl-button classes to show the different types of buttons. mdl_buttons.htm Live Demo <html> <head> <script src = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.min.js”> </script> <link rel = “stylesheet” href = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.indigo-pink.min.css”> <link rel = “stylesheet” href = “https://fonts.googleapis.com/icon?family=Material+Icons”> </head> <body> <table border = “0”> <tbody> <tr> <td><button class = “mdl-button mdl-js-button mdl-button–fab mdl-button–colored”> <i class = “material-icons”>add</i></button></td> <td><button class = “mdl-button mdl-js-button mdl-button–fab mdl-js-ripple-effect mdl-button–colored”> <i class = “material-icons”>add</i></button></td> <td> </td> </tr> <tr> <td>Colored fab (circular) display effect</td> <td>Colored fab (circular) with ripple display effect</td> <td> </td> </tr> <tr> <td><button class = “mdl-button mdl-js-button mdl-button–fab”> <i class = “material-icons”>add</i></button></td> <td><button class = “mdl-button mdl-js-button mdl-button–fab mdl-js-ripple-effect”> <i class = “material-icons”>add</i></button></td> <td><button class = “mdl-button mdl-js-button mdl-button–fab” disabled> <i class = “material-icons”>add</i></button></td> </tr> <tr> <td>Plain fab (circular) display effect</td> <td>Plain fab (circular) with ripple display effect</td> <td>Plain fab (circular) and disabled</td> </tr> <tr> <td><button class = “mdl-button mdl-js-button mdl-button–raised”> <i class = “material-icons”>add</i></button></td> <td><button class = “mdl-button mdl-js-button mdl-button–raised mdl-js-ripple-effect”> <i class = “material-icons”>add</i></button></td> <td><button class = “mdl-button mdl-js-button mdl-button–raised” disabled> <i class = “material-icons”>add</i></button></td> </tr> <tr> <td>Raised button</td> <td>Raised button with ripple display effect</td> <td>Raised button and disabled</td> </tr> <tr> <td><button class = “mdl-button mdl-js-button mdl-button–raised mdl-button–colored”> <i class = “material-icons”>add</i></button></td> <td><button class = “mdl-button mdl-js-button mdl-button–raised mdl-button–accent”> <i class = “material-icons”>add</i></button></td> <td><button class = “mdl-button mdl-js-button mdl-button–raised mdl-js-ripple-effect mdl-button–accent”> <i class = “material-icons”>add</i></button></td> </tr> <tr> <td>Colored Raised button</td> <td>Accent-colored Raised button</td> <td>Accent-colored raised button with ripple effect</td> </tr> <tr> <td><button class = “mdl-button mdl-js-button”> <i class = “material-icons”>add</i></button></td> <td><button class = “mdl-button mdl-js-button mdl-js-ripple-effect”> <i class = “material-icons”>add</i></button></td> <td><button class = “mdl-button mdl-js-button” disabled> <i class = “material-icons”>add</i></button></td> </tr> <tr> <td>Flat button</td> <td>Flat button with ripple effect</td> <td>Disabled flat button</td> </tr> <tr> <td><button class = “mdl-button mdl-js-button mdl-button–primary”> <i class = “material-icons”>add</i></button></td> <td><button class = “mdl-button mdl-js-button mdl-button–accent”> <i class = “material-icons”>add</i></button></td> <td> </td> </tr> <tr> <td>Primary Flat button</td> <td>Accent-colored Flat button</td> <td> </td> </tr> <tr> <td><button class = “mdl-button mdl-js-button mdl-button–icon”> <i class = “material-icons”>add</i></button></td> <td><button class = “mdl-button mdl-js-button mdl-button–icon mdl-button–colored”> <i class = “material-icons”>add</i></button></td> <td> </td> </tr> <tr> <td>Icon button</td> <td>Colored Icon button</td> <td> </td> </tr> <tr> <td><button class = “mdl-button mdl-js-button mdl-button–fab mdl-button–mini-fab”> <i class = “material-icons”>add</i></button></td> <td><button class = “mdl-button mdl-js-button mdl-button–fab mdl-button–mini-fab mdl-button–colored”> <i class = “material-icons”>add</i></button></td> <td> </td> </tr> <tr> <td>Mini Colored fab (circular) display effect</td> <td>Mini Colored fab (circular) with ripple display effect</td> <td> </td> </tr> </tbody> </table> </body> </html> Result Verify the result. Print Page Previous Next Advertisements ”;

MDL – Sliders

Material Design Lite – Sliders ”; Previous Next MDL provides a range of CSS classes to apply various predefined visual and behavioral enhancements and display the different types of menu. The following table lists down the available classes and their effects. Sr.No. Class Name & Description 1 mdl-slider Identifies input element as an MDL component and is required. 2 mdl-js-slider Sets basic MDL behavior to input element and is required. Example The following example will help you understand the use of the mdl-slider classes to show the different types of sliders. mdl_sliders.htm Live Demo <html> <head> <script src = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.min.js”> </script> <link rel = “stylesheet” href = “https://storage.googleapis.com/code.getmdl.io/1.0.6/material.indigo-pink.min.css”> <link rel = “stylesheet” href = “https://fonts.googleapis.com/icon?family=Material+Icons”> <script langauage = “javascript”> function showMessage(value) { document.getElementById(“message”).innerHTML = value; } </script> </head> <body> <table> <tr><td>Default Slider</td><td>Slider with initial value</td> <td>Disabled Slider</td></tr> <tr><td><input id = “slider1” class = “mdl-slider mdl-js-slider” type = “range” min = “0” max = “100” value = “0” tabindex = “0” oninput = “showMessage(this.value)” onchange = “showMessage(this.value)”></td> <td><input id = “slider2” class = “mdl-slider mdl-js-slider” type = “range” min = “0” max = “100” value = “25” tabindex = “0” oninput = “showMessage(this.value)” onchange = “showMessage(this.value)”></td> <td><input id = “slider3” class = “mdl-slider mdl-js-slider” type = “range” min = “0” max = “100” value = “25” tabindex = “0” step = “2” disabled oninput = “showMessage(this.value)” onchange = “showMessage(this.value)”></td> </tr> </table> Value: <div id = “message” >25</div> </body> </html> Result Verify the result. Print Page Previous Next Advertisements ”;