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 c...

问题:

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.


回答1:

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


回答2:

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; }

  • 发表于 2019-01-23 07:23
  • 阅读 ( 211 )
  • 分类:网络文章

条评论

请先 登录 后评论
不写代码的码农
小编

篇文章

作家榜 »

  1. 小编 文章
返回顶部
部分文章转自于网络,若有侵权请联系我们删除