htmlcssionicons

ionicons not showing up and It was working before


Ionicons was working and suddenly stopped working, i have no idea whats the problem, any ideas? I tried to remove the lead mr-2 but is still not working.

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="style.css">
    <link href="https://fonts.googleapis.com/css?family=Muli:300,700&display=swap" rel="stylesheet">

    <div class="d-flex">
        <div id="sidebar-container" class="bg-primary">
            <div class="menu">
                <a href="#" class="d-block text-light p-3"><ion-icon name="radio-button-off-outline lead mr-2"></ion-icon>Singles</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="radio-button-off-outline lead mr-2"></ion-icon>Doubles</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="radio-button-off-outline lead mr-2"></ion-icon>Lower Thirds & Commentators</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="podium-outline lead mr-2"></ion-icon>Bracket Top8</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="trophy-outline lead mr-2"></ion-icon>Results</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="document-text-outline lead mr-2"></ion-icon>Extras</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="cog-outline lead mr-2"></ion-icon>Settings</a>
            </div>
        </div>
    </div>

<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script src="https://unpkg.com/ionicons@5.1.2/dist/ionicons.js"></script>


Solution

  • You shouldn't put class names in (ion-icon name attribute)

    This is your tag:

    <ion-icon name="radio-button-off-outline lead mr-2">
    

    This is the solution:

    <ion-icon name="radio-button-off-outline" class="lead mr-2">
    

    Here's a full working demo:

    <!doctype html>
    <html lang="en">
      <head>
        <!-- Required meta tags -->
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <!-- Bootstrap CSS -->
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
        <link rel="stylesheet" href="style.css">
        <link href="https://fonts.googleapis.com/css?family=Muli:300,700&display=swap" rel="stylesheet">
        <!-- jQuery always goes to the head section -->
        <title>DASHBoard 2.0</title>
      </head>
      <body>
        <div class="d-flex">
            <div id="sidebar-container" class="bg-primary">
                <div class="menu">
                    <a href="#" class="d-block text-light p-3"><ion-icon name="radio-button-off-outline" class="lead mr-2"></ion-icon>Singles</a>
                    <a href="#" class="d-block text-light p-3"><ion-icon name="radio-button-off-outline" class="lead mr-2"></ion-icon>Doubles</a>
                    <a href="#" class="d-block text-light p-3"><ion-icon name="radio-button-off-outline" class="lead mr-2"></ion-icon>Lower Thirds & Commentators</a>
                    <a href="#" class="d-block text-light p-3"><ion-icon name="podium-outline" class="lead mr-2"></ion-icon>Bracket Top8</a>
                    <a href="#" class="d-block text-light p-3"><ion-icon name="trophy-outline" class="lead mr-2"></ion-icon>Results</a>
                    <a href="#" class="d-block text-light p-3"><ion-icon name="document-text-outline" class="lead mr-2"></ion-icon>Extras</a>
                    <a href="#" class="d-block text-light p-3"><ion-icon name="cog-outline" class="lead mr-2"></ion-icon>Settings</a>
                </div>
            </div>
        </div>
        <!-- Optional JavaScript -->
        <!-- jQuery first, then Popper.js, then Bootstrap JS -->
        <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
        <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
        <script src="https://unpkg.com/ionicons@5.1.2/dist/ionicons.js"></script>
      </body>
    </html>