Search code examples
htmlcssmaterialize

Materialize nav bar issue


So I have this navbar made with materialize

My code is:

<nav class="light-blue lighten-1 " role="navigation">
    <div class="nav-wrapper container "><a id="logo-container" href="#" class="brand-logo">Treasure Hunt</a>

        <ul id="navbarUl" class="right hide-on-med-and-down">
            <li class="active"><a href="#">Misiuni</a></li>
            <li><a href="#">NewsFeed</a></li>
            <li><a href="#">Clasament</a></li>
            <li><a href="#">  </a></li>
            <li id="navbarLi"> 
                <div class="row">
                    <div class="col s6"><a id="navbarImg" href="#"><img src="img/asd.jpg" class="circle responsive-img small"/></a></div>
                    <div class="col s6">Adyzds</div>






                </div>
            </li>

            <li >
                <div class="row">


                    <div class="col s4"><a href="#">Level:</a>
                        <span>Value</span>
                    </div>
                    <div class="col s4"><a href="#">XP:</a>
                        <span>Value</span>
                    </div>


                </div>
            </li>

        </ul>
    </div>
</nav>

My mouse is over the profile pic. I would like the hover effect to cover the name too. Also, I would like the Level value to be near Level. Can anyone help me?

CSS:

 .icon-block {
  padding: 0 15px;
}
.icon-block .material-icons {
    font-size: inherit;
}
#navbarImg{
    padding-top: 10px;
    max-width: 70px;
    max-height: 64px;
}
#navbarLi{
    max-height: 64px;
}

Solution

  • Your columns are too narrow for Level: + value. Instead of creating a row with 2 columns inside, try using seperate <li> for each:

    <li >
       <a href="#">Level: <span>7</span> </a>
    </li>    
    <li>
       <a href="#">XP:<span>105</span> </a>
    </li>
    

    As for your name, just nest it in a <a> element and materialize will know what to do with it.

    Check out this fiddle: https://jsfiddle.net/pwxa6e80/3/ ... hope it helps :)