0

my title inside my navbar for some reason is not moving to the center as I want to. I tried using padding, text-align and use right function all doesn't work. Can anyone help me? I tried following this question here but nothing happens, bootstrap 3 - how do I place the brand in the center of the navbar?

Here is the code whole code so sorry for the mess: app.blade.php

<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- CSRF Token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>{{ config('app.name', 'Laravel') }}</title>

    <!-- Styles -->
    <link href="{{ asset('css/app.css') }}" rel="stylesheet">
</head>
<body>
    <div id="app">
        <nav class="navbar navbar-default navbar-static-top">
            <div class="container">
                <div class="navbar-header">


                    <!-- Collapsed Hamburger -->
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#app-navbar-collapse" aria-expanded="false">
                        <span class="sr-only">Toggle Navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
<html>
<head>
              <title>SideBar Menu</title>
     <link href="{{ asset('css/style.css') }}" rel="stylesheet">
</head>

<body>

    <div id="sidebar">

        <ul>
            <li><a href="{{route('home')}}">Summary</a></li>        
            <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit User Information <span class="caret"></span></a>
          <ul class="dropdown-menu forAnimate" role="menu">
            <li><a href="{{ url('/edit') }}" style="color: red">Personal Information Edit</a></li>
          </ul>
        </li>

        <div id="sidebar-btn">
            <span></span>
            <span></span>
            <span></span>
        </div>

    </div>


    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script>

    $(document).ready(function(){
        $('#sidebar-btn').click(function(){
            $('#sidebar').toggleClass('visible');
        });
    });

    </script>
    </body>
    </html>

                    <!-- Branding Image -->
                    <a class="navbar-brand" href="{{ url('/') }}" style="color: white">
                        {{ config('app.name', 'Laravel') }}
                    </a>
                </div>

                <div class="collapse navbar-collapse" id="app-navbar-collapse">
                    <!-- Left Side Of Navbar -->
                    <ul class="nav navbar-nav">

                        &nbsp;
                    </ul>
                    <div id="center-text">
                        <ul class="nav navbar-nav navbar-center" id="nav-center">
                            <li>
                                <h3>@yield('title')</h3>
                            </li>
                        </ul>
                    </div>


                    <!-- Right Side Of Navbar -->
                    <ul class="nav navbar-nav navbar-right">
                        <!-- Authentication Links -->
                        @guest
                            <li><a href="{{ route('login') }}">Login</a></li>
                            <li><a href="{{ route('register') }}">Register</a></li>
                        @else
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true" style="background-color:blue" style="color:white">
                                    <b>{{ Auth::user()->name }}</b> <span class="caret"></span>
                                </a>

                                <ul class="dropdown-menu" style="background-color: blue">
                                    <li>
                                        <a href="{{ route('logout') }}"
                                            onclick="event.preventDefault();
                                                     document.getElementById('logout-form').submit();" style="background-color: blue" style="color: white">
                                            <b>Logout</b>
                                        </a>

                                        <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                                            {{ csrf_field() }}
                                        </form>
                                    </li>
                                </ul>
                            </li>
                        @endguest
                    </ul>
                </div>
            </div>
        </nav>

        @yield('content')
    </div>

    <!-- Scripts -->
    <script src="{{ asset('js/app.js') }}"></script>

</body>
</html>

css style I used it like this: style.css

body{
    margin:0px;
    padding:0px;
    font-family:"Helvetica Neue", Helvetica, Arial;
}

#sidebar{
    background:blue;
    width:200px;
    height:100%;
    display:block;
    position: fixed;

    left:-200px;
    top:0px;
    transition:left 0.3s linear;
}

#sidebar.visible{
    left:0px;
    transition:left 0.3s linear;
}

ul{
    margin:0px;
    padding:0px;
      list-style-type:none;
  display:flex;
  justify-content: center;
}

ul li{
    list-style:none;
}


ul li a{
    background:#0000FF;
    color:  white;
    border-bottom:1px solid #111;
    display:block;
    width:180px;
    padding:10px;
    text-decoration: none;
}

#sidebar-btn{
    display:inline-block;
    vertical-align: middle;
    width:20px;
    height:15px;
    cursor:pointer;
    margin:20px;
    position:absolute;
    top:0px;
    right:-60px;
}

#sidebar-btn span{
    height:1px;
    background: white;
    margin-bottom:5px;
    display:block;
}

#sidebar-btn span:nth-child(2){
    width:75%;
}

#sidebar-btn span:nth-child(3){
    width:50%;
}

#navbar-toggle collapsed{
    background:#0000FF;

}

.navbar {background:#0000FF;}

  nav.sidebar .navbar-nav .open .dropdown-menu>li>a:hover, nav.sidebar .navbar-nav .open .dropdown-menu>li>a:focus {
    color: white;
    background-color: transparent;
  }

#center-text ul{
  list-style-type:none;
  display:flex;
  justify-content: center;
}
blastme
  • 391
  • 7
  • 19
  • 37

2 Answers2

0

This should work

ul{
  list-style-type:none;
  display:flex;
  justify-content: center;
}
<ul class="nav navbar-nav navbar-center" id="nav-center">
      <li><h3>Text</h3></li>
 </ul>
Simon Bolduc
  • 175
  • 10
  • Sorry I thought it was the same didn't saw it, changed but still nothing happen – blastme Nov 10 '17 at 03:35
  • Sure, just want to check, I have also a sidebar in my app.blade and inside it has a css which affect it ul also, do you want me to put that inside as well? But it might be really long – blastme Nov 10 '17 at 03:36
  • Added a new answer that doesn't interfere with other classes – Simon Bolduc Nov 10 '17 at 03:43
  • Sorry I tried that as well but still nothing is happening – blastme Nov 10 '17 at 03:43
  • One of the Nav, navbar-nav, #nav-center is interfering – Simon Bolduc Nov 10 '17 at 03:45
  • I have updated the question where it show all my code @GeorgeLopton – blastme Nov 10 '17 at 03:46
  • Your HTML is all messed up, there's html and body tags everywhere, li that you tried to close using ul. Clear your code and it'll work – Simon Bolduc Nov 10 '17 at 03:50
  • @aGeorge Lopton the html tag you saw in the middle is for my sidebar and I actually want that sidebar to be inside the navbar, so I actually tried doing this. And for the li, are you referring to those sidebar li? Because if yes, I have removed some of them since the question has a limit number of words to put in, so there might be some missing tags – blastme Nov 10 '17 at 03:54