Trouble with MaterializeCSS icons displaying

I've been encountering an issue with displaying icons while using MaterializeCSS. Even though I followed the basic "Getting Started" instructions from the documentation, the icons are not showing up in my project. Below is the code snippet that I am currently using:

<!DOCTYPE html>
<html>

<head>
   <!--Import Google Icon Font-->
   <link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
   <!--Import materialize.css-->
   <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.6/css/materialize.min.css">
   <!--Let browser know website is optimized for mobile-->
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>

<body>
    <nav>
        <ul class="hide-on-med-and-down">
            <li><a href="#!">First Sidebar Link</a></li>
            <li><a href="#!">Second Sidebar Link</a></li>
        </ul>
        <ul id="slide-out" class="side-nav fixed">
            <li class="bold"><a href="#!" class="waves-effect waves-teal">First Sidebar Link</a></li>
            <li class="bold"><a href="#!" class="">Second Sidebar Link</a></li>
            <li class="no-padding">
                <ul class="collapsible collapsible-accordion">
                    <li>
                        <a class="collapsible-header waves-effect waves-teal">Dropdown<i class="mdi-navigation-arrow-drop-down"></i></a>
                        <div class="collapsible-body">
                            <ul>
                                <li><a href="#!">First</a></li>
                                <li><a href="#!">Second</a></li>
                                <li><a href="#!">Third</a></li>
                                <li><a href="#!">Fourth</a></li>
                            </ul>
                         </div>
                    </li>
                </ul>
            </li>
        </ul>
        <a href="#" data-activates="slide-out" class="button-collapse"><i class="mdi-navigation-menu"></i></a>
  </nav&rt
  <!--Import jQuery before materialize.js-->
  <script src="https://code.jquery.com/jquery-3.0.0.min.js" integrity="sha256-JmvOoLtYsmqlsWxa7mDSLMwa6dZ9rrIdtrrVYRnDRH0=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.6/js/materialize.min.js"></script>
  <script>
    $('.button-collapse').sideNav({
        menuWidth: 300, // Default is 240
        closeOnClick: true // Closes side-nav on <a> clicks, useful for Angular/Meteor
    });
    $('.collapsible').collapsible();
  </script>
</body>

</html>

The sole intention of this code is to display a basic navbar, exactly as described in the documentation.

However, there are two specific issues I'm facing: - The hamburger menu fails to appear when resizing the browser. - The dropdown arrow does not show up next to the dropdown menu item. I have spent hours trying to figure out what's wrong, but it seems like I'm missing something trivial. Any guidance or assistance would be incredibly helpful at this point.

Answer №1

UPDATE: I've managed to fix the issue with the dropdown arrow as well.

<i class="material-icons right">arrow_drop_down</i>

I faced the same problem and was left wondering where my hamburger icon had disappeared to!

Unfortunately, a significant portion of their documentation has not been updated, so the code you're using is outdated.

Make this change:

<i class="mdi-navigation-menu"></i>

to this:

<i class="material-icons">menu</i>

and you should be able to view the icon successfully. Their source code also confirms this discrepancy between what's on their site and what's in their docs:

https://i.sstatic.net/mn7JW.png

Answer №2

If you're experiencing issues with linking font libraries, try switching from HTTP to HTTPS. This simple change resolved the problem for me.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Expand your dropdown options with a Popup Input feature in the ComboBox to seamlessly add a 'New Option'

Hello there! I am currently learning, so please be patient with me. Currently, I am in the process of developing a web application for a product management system. The company I work for purchases products from multiple vendors, both through wholesale and ...

Using focusout and clicking buttons do not effectively interact with child elements

I have a series of div elements, each containing a button. When I click on a button, text is displayed, and when I click away, the information hides with a focus-out function. If I have one button open and then want to click on another parent button, it wo ...

The background is set and the vertical scrolling overflow is enabled

My website has an image set as the background, with a fixed position and overflow-y to allow scrolling. However, I have encountered an issue where the height of the image is causing problems on certain displays and resolutions. To temporarily fix this pro ...

Troubleshooting issues with media queries related to device pixel ratio

My media queries in LESS are functioning correctly on the desktop, but encountering issues when tested on an iPad2 or Samsung Galaxy 4 phone. It appears that the device-pixel-ratio is causing disruptions. I attempted to reduce the min-device-pixel-ratio to ...

Creating an Interactive Text Slider with jQuery

Looking for a way to have multiple div classes called quote that contains a text and a blockquote fade into the next one every 5 seconds? Check out the example markup below: <div id="quoteWrapper"> <div class="quote"> <blockquote>F ...

Error: Validation issues detected in field functionality

My goal is to loop through a set of text fields and check if the user has input any values. However, I'm facing an issue where even though I have provided values in the text fields, it seems like they are empty. To better illustrate my problem, I have ...

SoundCloud and Vimeo have the capability to link their players across separate tabs, and even between tabs and embedded players

I find it intriguing how SoundCloud and Vimeo are synchronized with their tabs, so that when you play something in one tab, the others pause. It's worth noting that this feature only works on SoundCloud when two instances of the website are open, wher ...

Slender Ebony Edging Surrounding a Table

I am trying to achieve a very thin border for the entire table, similar to what is shown in the image above. However, my current solution is not working as expected and the table is not displaying any borders at all. Below is the CSS I am using: table { ...

The effectiveness of Tailwind utility classes is exclusive to CSS files rather than inline code

My tech stack includes electron, react (web), typescript, and tailwind. Currently, I am encountering an issue where tailwind only applies styles in .css files but not inline. See the example below: In .css file (works) .navbar { @apply border-2 border ...

Inconsistency in spacing found in Bootstrap grid system

I have encountered a strange issue with a bootstrap grid layout. Here is the relevant code snippet: <div class="row"> <div class="col-xs-10 col-xs-offset-1 col-sm-6 col-sm-offset-2"> <img src="< ...

Reordering div elements with JavaScript

Let's say we have the following structure: <div id="left"> <div id="1"></div> <div id="2"></div> <div id="3"></div> <div id="4"></div> <div ...

css issue with focus on ie11

<style type="text/css"> .main { position: absolute; border-radius: 8px; border: none; height: 54%; top: 35%; /*33%*/ color: #FFFFFF; font-size: 0.7em; o ...

Is there a way to prevent screen flickering when navigating my character using arrow keys in JavaScript?

Seeking assistance for an issue with canvas flickering in JavaScript. I've successfully cleared the canvas before redrawing my game character, but I'm struggling to prevent screen flickering as the character moves. Any help would be greatly appre ...

Display the text '0 comments' on the posts.php webpage within Anchor CMS

I have implemented this PHP code to display comments on my homepage: Functions.php function show_article_comments() { return Comment::where('post', '=', article_id()) ->where('status', '=', 'approved& ...

When YII_DEBUG is disabled, the CSS will not be implemented

My website is built using Yii along with YiiBooster. Everything works fine when I am in DEBUG mode - all styles load and apply correctly. However, when I set YII_DEBUG to false in the index.php file, the CSS files still show as loaded in Firebug, but it ap ...

CSS might not always work properly on all web browsers, but it functions perfectly on Eclipse

When developing JSF pages with stylesheets, everything seems to be working fine in the Eclipse preview function. However, when I test the pages on IE8, the styles do not seem to have any effect. I am utilizing composite views to define a general layout fo ...

Finding attributes with spaces in their values using XPath

Is there a way to select an attribute with spaces in xpath? I am currently trying to select a checkbox attribute named "checked type". I have experimented with //[@checked type], //[@checked-type], //[@checked_type], and //[@checked\stype], but none ...

Deactivate the button when an item is selected from the dropdown menu in JavaScript

I am working on a dropdown menu containing values that link to functions, along with a textbox and submit button. My goal is to have the submit button disabled or hidden when a specific value is selected from the dropdown, possibly alongside clearing the c ...

Enable users to create posts with specific labels in PHP

Visitors to my website have the ability to post news updates. Currently, there is no specific restriction on the use of HTML elements. function addNewsUpdate($title, $content, $userID){ $timestamp = time(); $title = mysql_real_escape_string($title); ...

I'm having trouble getting this button and icon to align properly. How can I fix this misalignment

Take a look at the HTML code snippet I'm currently working on... <div id="projects"> <H1 class="projects">PROJECTS</H1> <div class="box"></div> <div class="box"></div> <div class="box"></ ...