Sam Flynn
Sam Flynn

Reputation: 29

Materialize nav content won't center ul element

I'm trying to center nav-content using center option

So it will look like this.

However it doesn't work on the ul attribute.

Ends up looking like this instead.

My code:

...
        <div class="nav-content center" style="background-color: black">
            <ul class="tabs tabs-transparent">
                <li class="tab"><a href="">Test 1</a></li>
                <li class="tab"><a href="">Test 2</a></li>
            </ul>
        </div>
    </nav>

Solution:

mdubus' answer is correct but it needs to be in the ul element instead of the div for it to work using Materialize.

Upvotes: 2

Views: 581

Answers (2)

Josef
Josef

Reputation: 91

I'm not familliar with materielize, you can do it with css, by stting the parent element to: flex and justifiy-content: center; or simply by setting .nav-content{ text-align: center; }

Upvotes: 0

mdubus
mdubus

Reputation: 130

On your div nav-content center, just add a display:flex; justify-content:center;. That should do the trick ;)

Upvotes: 2

Related Questions