Center an element in Bootstrap 4 Navbar

前端 未结 9 1303
甜味超标
甜味超标 2020-11-22 14:26

No matter what I try, I can\'t center something in Bootstrap navbar, any solutions for it?

I\'ve tried adding a div, using margin:0 auto; or marg

9条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 15:08

    make new style

    .container {
        position: relative;
    }
    .center-nav {
        position: absolute;
        left: 0;
        right: 0;
        margin: 0 auto;
        width: auto;
        max-width: 200px;
        text-align: center;
    }
    .center-nav li{
      text-align: center;
      width:100%;
    }
    

    Replace website name UL with below

    
    

    Hope this helps..

提交回复
热议问题