Google News
logo
Materialize CSS Interview Questions
Materialize is a User Interface (UI) component library. Introduced by Google (2014 – Present), Material Design is a language that combines the classic principles of successful design. Materialize UI components are mainly used to create innovative websites, web apps, android apps,..
Materialize CSS Badges can notify you that there are new or unread messages or notifications. You can add the new, badge classes to the badge to give it the background.
Materialize CSS provides two classes for BreadCrumb :
nav-wrapper : It is used to set the nav component as breadcrumb/nav bar wrapper.
breadcrumb : It is used to set the anchor element as breadcrumb.
Materialize provides different utility classes that are given below:
 
Color utility classes : Examples: .red, .green, .grey etc.

Alignment utility classes : Examples: .valign-wrapper, .left-align, .right-align, .center-align, .left, .right etc.

Hiding Content utility classes as per device size : Examples: .hide, .hide-on-small-only, .hide-on-med-only etc.

Formatting utility classes : Examples: truncate, hoverable etc.
There are following classes to create responsive and video that are listed table:
 
responsive-img: This class is used to create an responsive image.
video-container: It is used to create responsive container. That has embedded videos.
responsive-video: It is used to create HTML5 videos responsive.
Materialize provides two classes that are:
 
nav-wrapper: It is used to set the nav component as breadcrumb/nav bar wrapper.
breadcrumb: It is used to set the anchor element as breadcrumb.
Materialize provides various method to show unremarkable alerts. It also provides a term toast form them. Following is given syntax:
 
Materialize.toast(message, displayLength, className, completeCallback);
Where
 
message: It is used to displayed Message to the user.
displayLength: Duration of the message after it will disappear.
className: Style class to be applied to the toast. For example, ’rounded’.
completeCallback: This Callback method to be called once toast is dismissed.
Materialize CSS Badges can notify you that there are new or unread messages or notifications. You can add the new, badge classes to the badge to give it the background.
 
The following classes of Badges are used in Materialize CSS:
 
badge: It identifies element as an MDL badge component.
 
new: It is used to add a new class to badge component.
There are two types of dropdown classes in Materialize CSS:
 
dropdown-content: It Identifies HTML tag as an materialize dropdown component.
data-activates: It is id of the dropdown ul element.
Materialize CSS Pagination is used to split out your long pages into shorter, easier to understand blocks.
pagination : It is used to set the ul element as a pagination component.

<div class="container">

    <ul class="pagination">
        <li class="disabled"><a href="#!"><i class="material-icons">chevron_left</i></a></li>
        <li class="active"><a href="#!">1</a></li>
        <li class="waves-effect"><a href="#!">2</a></li>
        <li class="waves-effect"><a href="#!">3</a></li>
        <li class="waves-effect"><a href="#!">4</a></li>
        <li class="waves-effect"><a href="#!">5</a></li>
        <li class="waves-effect"><a href="#!">6</a></li>
        <li class="waves-effect"><a href="#!">7</a></li>
        <li class="waves-effect"><a href="#!"><i class="material-icons">chevron_right</i></a></li>
    </ul>

</div>​
Materialize CSS Chips can be used to represent small blocks of information. They are most commonly used either for contacts or for tags.
 
Contacts : Are you create a contact chip just add an img inside.
 
<div class="chip">
    <img src="https://www.freetimelearning.com/images/free-time-learn-icon.png" alt="Contact Person">
    F T L
</div>
 
Tags : Are you create a tag chip just add a close icon inside with the close class.
 
<div class="chip red white-text">
    Material Design
    <i class="close material-icons">close</i>
</div>
Materialize CSS Preloader is used when you have content that will take a long time to load. For this reason we provide a number activity + progress indicators. The main preloaders are : Linear, Circular, Circular Flashing Colors.

Circular : The circular spinners should be nested in a preloader-wrapper div. The default size is medium, but you can add the classes big or small to adjust the size accordingly. You can add the classes spinner-red-only, spinner-blue-only, spinner-yellow-only and spinner-green-only.

<div class="row">
    <div class="container">

            <div class="preloader-wrapper big active">
                <div class="spinner-layer spinner-blue-only">
                  <div class="circle-clipper left">
                    <div class="circle"></div>
                  </div><div class="gap-patch">
                    <div class="circle"></div>
                  </div><div class="circle-clipper right">
                    <div class="circle"></div>
                  </div>
                </div>
             </div>

     </div>
</div>​
Materialize CSS provides a 12 column fluid responsive grid system. The grid helps you layout your page in an ordered, easy fashion.
 
Materialized CSS Grid System : 

  Mobile Devices
<= 600px
Tablet Devices
> 600px
Desktop Devices
> 992px
Large Desktop Devices
> 1200px
Class Prefix .s .m .l .xl
Container Width 90% 85% 70% 70%
Number of Columns 12 12 12 12

Responsive Grid Examples : 

<div class="row center-align">
    <div class="col s12 blue"><p>s12</p></div>
</div>
<div class="row center-align">
    <div class="col s12 m4 l2 purple"><p>s12 m4</p></div>
    <div class="col s12 m4 l8 red lighten-1"><p>s12 m4</p></div>
    <div class="col s12 m4 l2 purple"><p>s12 m4</p></div>
</div>
<div class="row center-align">
    <div class="col s12 m6 l3 blue"><p>s12 m6 l3</p></div>
    <div class="col s12 m6 l3 amber"><p>s12 m6 l3</p></div>
    <div class="col s12 m6 l3 blue"><p>s12 m6 l3</p></div>
    <div class="col s12 m6 l3 yellow accent-4"><p>s12 m6 l3</p></div>
</div>

 
There are several utility classes in Materialize CSS which are used for designing needs.
 
Alignment classes : For example, .valign-wrapper, .left-align, .rightalign, .center-align, .left, .right.
 
Hiding Content classes  :  For example, .hide, .hideon-small-only, .hide-on-med-only, .hide-on-med-and-down, .hide-on-med-and-up and .hide-on-large-only.
 
Showing Content classes  :  For example, .show-on-small, .show-on-medium, .show-on-large, .show-on-medium-and-up, .show-on-medium-and-down.
Materialize CSS Media has several classes to make images and videos responsive to different sizes.
Materialize CSS Media has several types :
 
Responsive Images : To make images resize responsively (based on the screen size) to page width, you can add the class responsive-img to your image tag.
 
Circular images : To make images appear circular, add class="circle" this class image will be displayed in circular.
 
Responsive Embeds : To make your embeds responsive, To add video-container this class.
 
Responsive Videos : To make your HTML5 Videos responsive just add the class responsive-video to the video tag.
Materialize CSS Pulse buttons with captivating effect. Add the pulse class to your button. 

Note : This is meant for floating buttons, so it may not work perfectly with every component.

Pulse Structure : 
 
<div class="row">

	<div class="col s6 m3 m20_0">
    		<a class="btn btn-floating btn-large pulse"><i class="material-icons">menu</i></a>
    	</div>

</div>
In material design has several special shadow classes to display containers as paper-like cards with shadow, everything should have a certain z-depth. These shadows make texts and images more appealing.

You can easily apply this shadow effect by adding a classes are z-depth-0, z-depth-1, z-depth-2, z-depth-3, z-depth-4 and z-depth-5 to an HTML tag. Finally z-depth-0 can be used to remove shadows from elements that have z-depths by default.

Example :

<div class="row">
    
    <div class="col s6 m4 l2">
      	<div class="amber box-demo z-depth-3">
      		<p>z-depth-3</p>
      	</div>
    </div>

</div>
Materialize CSS Collections facilitate you to group list objects together. It represents various types of collections, where a collection is a group of related information items. There are Basic, Links, Active,  Headers, Secondary Content, Avatar Content, Dismissable Content and more...

Example : 

<ul class="collection">
  <li class="collection-item">HTML5</li>
  <li class="collection-item">CSS3</li>
  <li class="collection-item">Material Design</li>
  <li class="collection-item">Bootstrap 4</li>
</ul>​
Materialize Forms are the standard way to receive user inputted data. It provides a very beautiful and responsive CSS for form designing. The transitions and smoothness of these elements are very important because of the inherent user interaction associated with forms.

The forms are Input fields, Textarea, Select, Radio Buttons, Checkboxes, Switches, File Input, Range, Date Picker, Time Picker, Character Counter, Autocomplete etc,..

Example : 

<form class="col s12">
  <div class="row">
    <div class="input-field col s6">
      <input placeholder="Placeholder" id="first_name" type="text" class="validate">
      <label for="first_name">First Name</label>
    </div>
    <div class="input-field col s6">
      <input id="last_name" type="text" class="validate">
      <label for="last_name">Last Name</label>
    </div>
  </div>
  <div class="row">
    <div class="input-field col s12">
      <input disabled value="I am not editable" id="disabled" type="text" class="validate">
      <label for="disabled">Disabled</label>
    </div>
  </div>
  <div class="row">
    <div class="input-field col s12">
      <input id="password" type="password" class="validate">
      <label for="password">Password</label>
    </div>
  </div>
  <div class="row">
    <div class="input-field col s12">
      <input id="email" type="email" class="validate">
      <label for="email">Email</label>
    </div>
  </div>
  <div class="row">
    <div class="col s12">
      This is an inline input field:
      <div class="input-field inline">
        <input id="email" type="email" class="validate">
        <label for="email" data-error="wrong" data-success="right">Email</label>
      </div>
    </div>
  </div>
</form>​
Material Design Collapsibles are accordion elements that expand when clicked on. They allow you to hide content that is not immediately relevant to the user. Materialize CSS provides different types of CSS collapsible classes, there are accordion, popout, active, expandable and more..
 
Initialization jQuery Plugin : 
 
Collapsible elements only need initialization if they are added dynamically.
 
$(document).ready(function(){
    $('.collapsible').collapsible();
  });
 
<div class="container">
    
  <ul class="collapsible" data-collapsible="accordion">
      <li>
        <div class="collapsible-header"><i class="material-icons">code</i>HTML5</div>
        <div class="collapsible-body"><span>HTML5 (No space between "HTML" and "5")is a markup language.</span></div>
      </li>
      <li>
        <div class="collapsible-header"><i class="material-icons">edit</i>CSS3</div>
        <div class="collapsible-body"><span>The first working draft of CSS3 came in 19-01-2001. </span></div>
      </li>
  </ul>

</div>
Use a Material Design Modal for dialog boxes, confirmation messages, or other content that can be called up. In order for the modal to work you have to add the Modal ID to the link of the trigger.

Basic Modal :

<!-- Modal Trigger -->
<a class="waves-effect waves-light btn modal-trigger" href="#modal_box">Basic Modal</a>

<!-- Modal Structure -->
<div id="modal_box" class="modal">
    <div class="modal-content">
      <h4>Modal Header</h4>
      <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the...</p>
    </div>
    <div class="modal-footer">
      <a href="#!" class="modal-action modal-close waves-effect waves-red btn">Agree</a>
    </div>
</div>
Material Design Parallax is an effect where the background content or image in this case, is moved at a different speed than the foreground content while scrolling.
 
Parallax Structure :
 
<div class="parallax-container">
    <div class="parallax">
    	<img src="../images/parallax_img.jpg" class="responsive-img" alt="Parallax">
    </div>
</div>
 
jQuery Initialization :
 
$(document).ready(function(){
    $('.parallax').parallax();
});
Material Design Pushpin means fixed positioning plugin. Use this to pin elements to your page during specific scroll ranges. You can check out the following  example.

Demo Code : 

$('.pushpin-demo-nav').each(function() {
    var $this = $(this);
    var $target = $('#' + $(this).attr('data-target'));
    $this.pushpin({
      top: $target.offset().top,
      bottom: $target.offset().top + $target.outerHeight() - $this.height()
    });
});

// Only necessary for window height sized blocks.
html, body, .block {
   height: 100%;
}
 
jQuery Plugin Initialization :

Here is a sample initialization of materialize pushpin.
 
$(document).ready(function(){
    $('.target').pushpin({
      top: 0,
      bottom: 1000,
      offset: 0
    });
});
Materialize Scrollspy is a jQuery plugin that tracks certain elements and which element the user's screen is currently centered on. Our main demo of this is our table of contents on every documentation page to the right.
Materialize CSS Waves is an external library that we've included to create the ink effect outlined in Material Design.
 
Applying Waves : 

The waves effect can be applied to any element. To put the waves effect on buttons, you just have to put the class waves-effect on to the buttons. If you want the waves effect to be white instead, add both waves-effect waves-light as classes.

<div class="row">
       <tr>
         <td>waves-light</td>
         <td class="center-align">
           <a class="waves-effect blue waves-light btn" href="#!">Click Here !</a>
         </td>
       </tr>
</div>​