Feature discovery on page load

Quickly implement Feature discovery on page load in 3 Steps

Learn Feature discovery on page load

Offer some incentive and support return visits by acquainting clients with new features and usefulness at logically significant minutes. 

Feature discovery prompts have more effect when they are displayed to the correct clients at logically significant minutes. At the point when displayed to the wrong client at the wrong time, they can be meddlesome and irritating.

Feature Discovery can be utilized to intimate users about new functionality or a feature on the website. We can use Feature Discovery to bring in call to action buttons in the website. 

In the Materialize CSS website, the documentation is poorly built and it is tedious to make the Feature Discovery work in your website, especially on the page load. We at Ampersand Academy developed the working script for Feature Discovery. 

In this example, we have enabled Feature Discovery for Call to Action button. Visitors who access the website from their mobiles can contact the Company / Website Owner directly. If a visitor access the website from the Desktops / Laptops they can view the mobile number which they use to contact the Company / Website Owner via the Feature Discovery Feature. 

This is one of the basic examples in which call to action button is used for contacting the company. One may use Feature Discovery creatively for conveying the message uniquely. 

Visit the following link to read the Official Documentation for Feature Discovery. However, you should be using the HTML code and JS code mentioned below to make it work.

phone

    <div class="tap-target" data-target="menu">
        <div class="tap-target-content">
          <h5 class="white-text">Hi there!</h5>
          <p class="white-text">You can call us in +91 9876543210 or click the button while you browse from mobile</p>
        </div>
    </div>
<script>
		 document.addEventListener('DOMContentLoaded', function() {
				var elems = document.querySelectorAll('.sidenav');
				var instances = M.Sidenav.init(elems, {});			 
           var elemsTap = document.querySelector('.tap-target');
    var instancesTap = M.TapTarget.init(elemsTap, {});
             instancesTap.open()
			  });
		</script>
Feature discovery on page load
Feature discovery on page load
Feature discovery on page load

Learn about Mobile Menu with Accordion

Easily implement Mobile menu with accordion type sub menu items in 2021

Learn Mobile menu with accordion type sub menu items

Materialize CSS is one of the most easy-to-use CSS frameworks for website development. Materialize CSS offers easy to use CSS and JS scripts to enable mobile responsive side navigation. In the previous tutorial, we have discussed how to add responsive mobile side navigation both on the left and right side. If you want to learn how to create mobile responsive side navigation follow the link.

In this tutorial, you will learn how to create accordion-like submenu items on the side navigation. For this, first, we have to create a side navigation menu. Suppose, if there is the main level menu and sub-level menu. For example, take an e-commerce website you have Men and Women Dresses. Under the Men’s section, you will have Trousers, Shirts, Shoes, etc. On the same line, the Women’s section will have Skirts, Trousers, Tops, etc. In order to have a layout that depicts this level, the following things have to be done. Open the collapsible section in materialize CSS website and copy the HTML and JS for accordion and paste in the list item of side nav. 

The HTML code has to be copy-pasted inside li tag of side navigation. The javascript has to be included inside the script tag where we already have a script for side navigation. 

Once you have added the script, you can now rename the Accordion Header and add the list item inside collapsible body check as required. 
In our case, we have created 3 headers Men’s Dresses, Women’s Dresses and Children’s Dresses and each header have their respective sub-items such as Trousers, Shirts, T-Shirts, Shoes, Skirts, etc.

Mobile menu with accordion type sub menu items
Mobile menu with accordion type sub menu items

We can also explore having Collapsible type menu level instead of Accordion type based on the requirement. It can be achieved by simply calling the key value accordion: false in the javascript. This will create sub-menu with collapsible type instead of Accordion Type. 

Learn about Opening Side Nav on Right Side in Materialize CSS. For more details about various courses, check out Ampersand Academy.

How to open SideNav on the right in Materialize CSS

How to open SideNav on the right in Materialize CSS in 3 Minutes

Learn How to open SideNav on the right in Materialize CSS

Mobile responsive navigation is one of the important aspects of a responsive website. It is possible to create beautiful main navigation for desktop/laptop browsers, however, when we design mobile navigation it is a must to make it easily accessible from all mobiles and tablets. There should be a mobile responsive button trigger and when a user clicks it, it should open up a mobile navigation. Follow this link to access the documentation for Sidenav in Materialize CSS.

There are two options when we create a mobile responsive navigation trigger and navigation panel. Either you can have it on the left or on the right. It is possible to create a mobile trigger button on the left and navigation panel, however, some users find the navigation button and panel on the left not that user-friendly. Materialize CSS offers a mobile responsive panel and trigger button on the left. The developers always look forward to having an easy hack to make the mobile responsive menu trigger and panel to the right.

This tutorial helps developers to implement a mobile responsive menu trigger and panel on the right. First, it is a must to incorporate the navigation bar in the website. Materialize CSS offers several variants of the navbar. Know how to create NavBar from this link

The first step you must do is to copy the Mobile Collapsible Navbar from the website along with the JavaScript. The JavaScript code has to be mentioned inside the script tag just above the body close tag.

How to open SideNav on the right in Materialize CSS
Right Side Nav

This will produce a Navbar with collapsible button and navigation pane on the left

If you would like to have the Mobile Menu Trigger button on the right, just add the class “right” next to “sidenav-trigger” class in the mobile menu trigger HTML code. 

<nav>
            <div class="nav-wrapper">
              <a href="#!" class="brand-logo">Logo</a>
              <a href="#" data-target="mobile-demo" class="sidenav-trigger right"><i class="material-icons">menu</i></a>
              <ul class="right hide-on-med-and-down">
                <li><a href="sass.html">Sass</a></li>
                <li><a href="badges.html">Components</a></li>
                <li><a href="collapsible.html">Javascript</a></li>
                <li><a href="mobile.html">Mobile</a></li>
              </ul>
            </div>
          </nav>

          <ul class="sidenav" id="mobile-demo">
            <li><a href="sass.html">Sass</a></li>
            <li><a href="badges.html">Components</a></li>
            <li><a href="collapsible.html">Javascript</a></li>
            <li><a href="mobile.html">Mobile</a></li>
          </ul>

This is will render the mobile collapsible menu on the right and when the user clicks the navigation pane will open on the left side.

If you would like to bring the mobile navigation pane on the right side, add the key-value pair edge:’right’ in the Javascript. The code for which is mentioned below

 <script>
         document.addEventListener('DOMContentLoaded', function() {
    var elems = document.querySelectorAll('.sidenav');
    var instances = M.Sidenav.init(elems, {edge:'right'});
  });
</script>
How to open SideNav on the right in Materialize CSS
How to open SideNav on the right in Materialize CSS

This will render the mobile navigation pane on the right. In the next tutorial, you will learn how to create accordion-type side navigation items. Now that we have seen how to open SideNav on the right in Materialize CSS, Learn about Colors in Materialize CSS.

Working with colors in Materialize CSS

Working with colors in Materialize CSS

Learn Working with colors in Materialize CSS

Changing the text and container colour on a website is one of the basic yet frequently performed tasks while designing a website. Usually, changing the colour is done using CSS. A designer can either use in-line CSS or write a class for changing the colour. 
In Materialize CSS, the framework developers have made the process of changing the colour of both the text and container easy. Just by calling the colour name inside the class tag will produce the desired result. For example, if you would like to have red colour text colour, just add the text red-text inside the h1 tag.

Here’s the link to Materialize CSS Color Library.

<div class="row red-text">
<h1>Changing color of text</h1>
</div>
Working with colors in Materialize CSS

In order to achieve this in CSS, we have to write the code as follows … 

<div class="row" style="color: red">
<h1>Changing color of text</h1>
</div>

Furthermore, in order to achieve the change in background colour in CSS following is the code 

<div class="row" style="background-color: red">
<h1>Changing color of division</h1>
</div>

The same result can be achieved by simply adding the text red in the div class, the following is the code

<div class="row red">
<h1>Changing color of division</h1>
</div>

Materialize CSS has not only eased the process of adding colour to the text and division but also enabled the designers to follow consistency in the design level.

Learn about Mega Menu in Materialize CSS

Mega menu for Materialize CSS Framework

Mega menu for Materialize CSS Framework

Learn Mega menu for Materialize CSS Framework and implement where it requires a huge menu

This tutorial briefs how to add a Mega menu in Materializecss.com. As we know, there is no default option in Materializecss Framework for Megamenu, we take the privilege in demonstrating how to add a mega menu using simple CSS classes. 

What is available in MaterializeCSS.com?
MaterializeCSS in default provides navbar components with several variants such as Logo with Right Aligned Links, Logo with Left Aligned Links, Center Logo Option, Fixed Navbar, Navbar with Tabs, Navbar with Dropdown Menu and Search Bar. However, there is no default option to create Megamenu in MaterializeCSS. In the following, we shall discuss how a standard Navbar can be inserted and how to create a Mega menu in the Navbar.

Steps to Create Standard Navbar with a drop-down menu:

1. Download the starter pack of MaterializeCSS Framework from the following link:
http://materializecss.com/getting-started.html

2. Extract to a folder.

Mega menu for Materialize CSS Framework
Mega Menu in Materialize CSS

3. Create index.html in the same folder using the HTML Setup given in the above-mentioned link.

Index File
  1. Now that the index file has been set up, add the Navbar with Dropdown Component from the following link:
    http://materializecss.com/navbar.html
    In the above link copy Navbar Dropdown Menu Script and paste it in the body of the index.html
Navbar in Materialize CSS

5. In order to activate the drop-down functionality add the following JavaScript just before tag and within the $( document ).ready(function) block as given below:

<script>
$( document ).ready(function(){     
$(".dropdown-button").dropdown(); 
})
</script>  
Dropdown in Materialize CSS

6. Now a standard navbar with a drop-down menu is created and you will be getting a result as given below.

Dropdown output

Steps to Mega Menu from the Standard Navbar with drop-down Menu:

1. Once we have the Navbar with a drop-down menu, we can convert the drop-down menu into a mega menu. In the index.html, you will now find a <ul> element with id=”dropdown1″. Modifications have to be done in this <ul> in order to achieve mega menu. 

2. First, add a class name “mega” next to the “dropdown-content”.

Dropdown list
  1. Now write CSS property for the .mega class. In order to increase the width of the dropdown, add min-width CSS property in the mega class as below. 
    Note: 
    You can set the min-width value as per your requirement. Here, min-width is set to 610 px. 
<style>
.mega {
min-width: 610px !important;
}
</style>

The style script has to declared just before the </head> tag

Megamenu width

4. Now you can see that the width of the drop-down menu has increased. Now we can add columns and rows and create the mega menu. In order to add column and rows, the respective script has to be included within the
tag with “dropdown-content” class. 

Increased Dropdown Width
  1. Here, we have intended to create a Mega menu with three column with respective headers.
    In order to achieve the above, first, we will be creating a ROW inside the <ul> tag
<ul id="dropdown1" class="dropdown-content mega">
<div class="row">            
</div>
</ul>

Second, we will be splitting the row into three columns

<ul id="dropdown1" class="dropdown-content mega">
<div class="row">
<div class="col m4">
<li><a href="#!">one</a></li>
<li><a href="#!">two</a></li>
<li class="divider"></li>
<li><a href="#!">three</a></li>
</div>
<div class="col m4">
<li><a href="#!">one</a></li>
<li><a href="#!">two</a></li>
<li class="divider"></li>
<li><a href="#!">three</a></li>
</div>
<div class="col m4">
<li><a href="#!">one</a></li>
<li><a href="#!">two</a></li>
<li class="divider"></li>
<li><a href="#!">three</a></li>
</div>
</div>
</ul>

Third, now we can add the headers to respective columns

<ul id="dropdown1" class="dropdown-content mega">
<div class="row">
<div class="col m4">
<li>Head 1</li>
<li><a href="#!">one</a></li>
<li><a href="#!">two</a></li>
<li class="divider"></li>
<li><a href="#!">three</a></li>
</div>
<div class="col m4">
<li>Head 2</li>
<li><a href="#!">one</a></li>
<li><a href="#!">two</a></li>
<li class="divider"></li>
<li><a href="#!">three</a></li>
</div>
<div class="col m4">
<li>Head 3</li>
<li><a href="#!">one</a></li>
<li><a href="#!">two</a></li>
<li class="divider"></li>
<li><a href="#!">three</a></li>
</div>
</div>
</ul>
Mega Menu With three columns

Additional Notes:

What is Megamenu?

Megamenu is one of the recent advancements of a drop-down menu. It is nothing but a drop-down menu where a website developer can group individual menu items under categories. For example, consider an apparel e-commerce website where one will have a general shop button under which you can have group categories for Men’s Apparel Section, Women’s Apparel Section, Kid’s Apparel Section and under each Category Section there will individual items such as Shirts, Trousers, Jeans, etc. 

Learn about adding logo to navbar in Materialize CSS

Adding Logo to the Navbar in Materialize CSS

Adding Logo to the Navbar in Materialize CSS

Learn Adding Logo to the Navbar in Materialize CSS and implement in you website and web applications

In the previous tutorial, we discussed how to create Navbar using Materialize CSS Framework. If we explore the coding involved in the Navbar, there is an individual component named Logo.  The Logo mentioned there is just a text and this can be changed to the image. Most of the Clients will be having their company logo, which can be added in this section. In order to demonstrate, how to add an image logo in the navbar, we have created a dummy logo and added it to the Project Folder. Usually, the logo image can be in the following formats: jpg, jpeg, png, or SVG. 

Adding Logo to the Navbar in Materialize CSS
Adding Logo to the Navbar in Materialize CSS
Logo

Now that we have a sample logo in our images, we can change the Logo text to a sample logo image.

Adding logo – Code

Here <img> tag is used to insert the logo file. Furthermore, in order to control the width and height of the logo, width and height classes are used.  The width and height can be adjusted according to the requirement.

Now we have the logo in our Navbar

navbar in materialize css

Navbar in Materialize CSS

Learn about Navbar in Materialize CSS

Creating Navigation Bar

A navigation bar is a section of a graphical user interface intended to aid visitors in accessing information. Navigation bars are implemented in file browsers, web browsers and as a design element of some websites. Web Applications also require Navigation Bar in order to ease the access of the application. Materialize CSS provides a wide variety of Navigation bar types. Each Navbar option will be used in different scenarios.

Option 1: Left Aligned Logo and Right Aligned Links

All the components which have to be present on the website have to be added inside the body tag of the HTML file. All the style classes can be added in a separate file named style.css and can be linked to the HTML tag as we linked the Materialize CSS files. The first step in learning Navbar in Materialize CSS is to add Materialize CSS files in your working directory and call both CSS and JS files.

In order to add the Materialize Navbar in the HTML Structure we created, we refer to the Materialize CSS website and call in the Navbar coding and paste it into the body tag. You can get the navbar coding from Materialize CSS Website

navbar in materialize css
Navbar code

The Navbar code will create a navigation bar with left aligned logo slot and right aligned menu links. 

By default, Materialize CSS generates Navbar in Red color which can be changed by overriding the color class. In Materialize CSS it is easy to change the color of any container, just by referring the Materialize CSS Color documentation and adding the required color name we can change the color of any container. In this case, if it is required to change the color of the navbar to blue, just add class=”blue” inside the nav tag.

Navbar Blue Coding

Option 2: Right-Aligned Logo and Left-Aligned Links

In the above coding, if we change the class at two places we can achieve Right Aligned Logo and Left-Aligned Links. 

First, we should change the alignment inside <ul> from right to left. 

Second, we should add the class right next to the brand-logo class.

Output as follows

Option 3: Centering the Logo

We can align the logo to the center of Navbar easily by simply changing the alignment class right to center in the Option 2

The output will be as follows

Option 4: Active Navbar Items

Active Items in Navbar simply means that the highlighted menu item is the current page. In order to highlight a menu item as active, add class=”active” to the respective menu item <li>

The output will be as follows. Kindly note the darker shade of blue which relates to the active class.

Now that you know Navbar in Materialize CSS, Learn about Materialize CSS Simple Raised Button.

Materialize CSS Websites

First step in building Materialize CSS Websites and webpages

Learn the First step in building Materialize CSS Websites and webpages.

Download the Framework files from the Materialize CSS Framework Website, i.e., http://materializecss.com/getting-started.html. Extract the files and add the extracted files in the Project Directory. For this, you can create a new folder in Desktop.

Materialize CSS Websites
Download Method

On the contrary, without downloading the Framework files, we can add the respective CSS, JS and jQuery CDN in the Project HTML File. CDN link can be obtained from the link mentioned

Download the Framework files:

1. Go to the link: http://materializecss.com/getting-started.html

2. Download the Materialize CSS files

3. Once you have downloaded the zip file. You can extract to get the following files

Materialize CSS Project

The extracted folder contains CSS, JS and Fonts folder which contains respective files. Materialize CSS by default has Roboto font which can be changed as per requirement.

Creating HTML Pages

In order to work with CSS, JS and HTML files, we need a text editor, such as Brackets or Sublime Text Editor. It can be downloaded from their respective websites. 

After installing the Text Editor, you can add the Project Folder which contains the downloaded Materialize CSS Framework files and creates the index.html file in the folder

Traditional Method

Now in the index file, you can link the corresponding JS, CSS files. 

Project Folder

Note that we have used a CDN for the JQuery, you can also download the JQuery from the respective website, move it to the JS folder in our Project and link it as we have linked the Materialize CSS and JS files.

CDN Method

Instead of downloading the files from Materialize CSS we can also directly link the CDN hyperlinks for CSS and JS components which provided in the Materialize CSS website. This method is equal to that of the traditional method.

CDN Method

Now we are done with setting up the first Materialize CSS Project. Going further, we shall see how to create Navigation Bar, Menu, Creating Mega Menu, Cards, Buttons in the website/web pages. Learn about Materialize CSS Features

Materialize CSS - Features

Quick Read on Materialize CSS Features in 2021

Materialize CSS Features

Materialize CSS - Features
Materialize CSS Features

Introduction to Materialize CSS

•    Materialize CSS is one of the most trending and easy to use Web UI Framework
•    It is open source and can be used by all
•    Materialize is a UI component library created with CSS, JavaScript, and HTML
•    It can be easily understood and implemented after the training
•    It is augmented with several HTML, CSS, JS Components
•    It follows a grid system
•    It can be leveraged to create device-friendly webpages/websites
•    Adhere to modern web design principles like browser portability, device independence
•    Inspires Google Material Design Concepts

Materialize CSS Features

•    Responsive Designing 
•    Standard CSS
•    Provides Form Components such as Buttons, Check Boxes, Text Fields and many more based on Material Design
•    Provides Card Layouts, Modals, Tabs, Navigation, Bars, and many more
•    Requires jQuery
•    Open Source, i.e., Free to Use

What is Responsive Web Design?

•    Web Pages will act like water, i.e., adapt itself to the screen from which it is viewed as the water takes the shape of the container it is poured into
•    Materialize CSS is designed in such a way that all its CSS classes and components fit any screen size
•    Websites developed using Materialize CSS are fully compatible with PC, Tablets and Smart Phones    

Customizable

•    Materialize CSS provides very minimal and fully customizable CSS components
•    Materialize CSS is designed in such a way that all its default style classes can be overridden by our desired or required styles
•    It supports bright colours, shadows and animations
•    It is designed in such a way that all its colour and effects remain consistent across all the supported devices

Learn about the Materialize CSS Raised Button and Customization.

For more details about various courses, check out Ampersand Academy.

Materialize CSS Simple Raised Button Customization

Learn about Materialize CSS Simple Raised Button Customization.

Introduction:

Buttons are one of the most widely used elements in any of the HTML Frameworks. No wonder it is going to be different in Materialize CSS Framework. There are several types of buttons that are present in Materialize CSS Framework which includes Simple Button, Simply Raised Button, Flat Buttons, Floating Button, Fab Buttons, Disabled Buttons and much more. This tutorial will be brief about customizing a simple raised button and changing its style according to the need. 

Simple Button

In Materialize CSS it is easy to create a button. By simply adding “btn” class in <a> will produce a simple raised button with teal colour. Teal is the default colour that Materialize CSS Framework produces when no colour is specified. 

<a href="#" class="btn">Test</a>
Simple Raised Button

Changing Color in Simple Button

It is easy to change the colour of buttons in Materialize CSS Framework. By simply adding the colour name as prescribed in the Materialize CSS Framework Color Palette with the class will produce preferred colours. 

Link for Color Palette:

http://materializecss.com/color.html

Now in order to change the default Teal colour of the button to Dark, Red, we can add the class red darken-4 class inside the Class. This will produce a Simple Raised button with a Dark Red colour. 

<a href="#" class="btn red darken-4">Test</a>
Red Button

We can either darken the main colour by adding darken class next to the prime colour. Materialize CSS give 4 variations for darkening as well as for lightening and accent shades. You can play around and produce several colour variations according to the need. 

We can also apply a new colour that is not present in the Materialize CSS using CSS properties. For example, if I wish to add orange colour with hex code: #FF6347, the following method will help in adding custom colour to the button.

<a href="#" class="btn" style="background-color: #FF6347">Test</a>
Materialize CSS Simple Raised Button Customization
Custom Colour Button in Materialize CSS

In the above Orange Button, if you wish to change the text colour to Black, the coding is as follows:

<a href="#" class="btn" style="background-color: #FF6347; color:black">Test</a>
Simple Raised Button with Black Text

Changing Button Size

There is a default option in Materialize CSS Framework to increase the size of the button. By simply adding btn-large class next to btn class will increase the size of the button.

<a href="#" class="btn btn-large">Test</a> 
Button Large

Disabled Button

Materialize CSS provides an easy option to add a button disable property to a button. Simply adding a disabled class next to the btn class will create a Disabled Button. 

<a href="#" class="btn disabled">Test</a>
Button Disabled

Waves Effect

Wave is an external library that produces an ink ripple effect in button components. Materialize CSS provides a waves effect to buttons. The waves effect can be added to any button by simply adding the class waves-effect next to the btn class. This produces an ink ripple effect when a button is clicked. Furthermore, waves have several options which can be implemented in buttons. Let’s discuss everything in detail.

Simple Waves Effect

Waves-effect creates an ink wave effect in a button. The colour of the waves will be similar to that of the button colour. 

<a href="#" class="btn waves-effect">Test</a>

Waves Light

Waves-light class, when applied along with the Waves-effect, will produce ink waves in white colour. These effects can be utilized in various scenarios where the white tint is required. 

Waves Color

In Materialize CSS, there are several predefined waves colour that can be utilized in the button. Materialize CSS offers various Wave Colors such as White, Red, Yellow, Orange, Purple, Green, and Teal. These predefined waves colour can be directly called by adding respective classes such as waves-red, waves-green, etc.

<a href="#" class="btn waves-effect waves-red">Test</a>

Colour of the waves can be customized by creating new classes, for example, if you require brown waves effect you can use the following CSS

.waves-effect.waves-brown .waves-ripple {‘
 background-color: rgba(121, 85, 72, 0.65);
}
<a href="#" class="btn white black-text waves-effect waves-brown">Test</a>

Button with Icons

Materialize CSS provides an easy way to integrate icons into Buttons. In order to add icons to buttons, we need to add Google Material Icons CDN to the Website. After adding CDN, it is easy to call the icon in a button. We can change the icon as per our requirement by cross-referencing with the Google Material Icon list. The following coding will explain how icons are added to the button.

<a class="waves-effect waves-light btn"><i class="material-icons left">cloud</i>button</a>

You can also check the Materialize Card Animation Tutorial.