简体   繁体   中英

Bootstrap dropdown align right fail

I have tried to allign my dropdown to the right part of navbar but failed, I have tried a lot of way to do it, in all ways I have failed. If there is any way to fix this someone help me please, thanks in advance.

<?php
$curdir = getcwd ();
chdir('/forum');
require_once('/global.php');
chdir ($curdir);
$username=$vbulletin->userinfo['username'];
?>
<div class="navbar-wrapper">
     <div class="container">
        <div class="navbar navbar-inverse">
          <div class="navbar-inner">
            <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
            </button>
            <a class="brand" href="/index.php"></p>Name</p></a>
            <div class="nav-collapse collapse">
              <ul class="nav">
              <li>
                                <a href='/index.php'><img src="/home.png" height="25" width="25"> Home</b></a>
                            </li>

                            <li>
                                <a href='/forum'><img src="/forum.png"> Forum</a>
                            </li>
                             <li class='dropdown'>
                                <a href='#' class='dropdown-toggle' data-toggle='dropdown'><img src="P.png"> Players<b class='caret'></b>

                                </a>
                                <ul class="dropdown-menu">
                                    <li>
                                        <a href="action.php"><img src="/action.php"> Action</a>
                                    </li>                                 
                                </ul>
                            </li>
                            <?php if ($vbulletin->userinfo['usergroupid'] == '1' )
                            echo "
                            <li class='dropdown'>
                                <a href='#' class='dropdown-toggle' data-toggle='dropdown'><i class='icon-user icon-white'></i> Welcome Guest<b class='caret'></b>
                                </a>
                                <ul class='dropdown-menu'>
                                    <li>
                                        <a href='#'><img src='/img/connectserver.png'> Action</a>
                                    </li>
                                    <li>
                                        <a href='/login.php'><i class='icon-ban-circle'></i> Login</a>
                                    </li>
                                    <li>
                                        <a href='register.php'><i class='icon-ok'></i> Register</a>
                                    </li>
                                </li>
                                </ul>
                                </ul>
                            </li>";?>
                            <?if ($vbulletin->userinfo['usergroupid'] != '1' )
                            echo "
                        </li>
                            <li class='dropdown'>
                                <a href='#' class='dropdown-toggle class='nav pull-right' data-toggle='dropdown'><img src='/img/connectserver.png'></i> Welcome <font color='red'>$username</font><b class='caret'></b>
                                </a>
                                <ul class='dropdown-menu'>
                                    <li>
                                        <a href='#'><img src='/img/connect.png' height='19' width='19'> Connect to server</a>
                                    </li>
                                    <!-- <li>
                                        <a href='#'><img src='/log-out.png' height='19'  width='19'> Log out</a>

                                    </li>  -->  
                                </li>
                                </ul>
                            </li></p>";?>
              </ul>
            </div>
          </div>
        </div>
      </div>
    </div>

The html looks invalid. I cannot see all your code but it seems you have a closing li tag after your closing ul tag inside ap tag? li's can only be inside ul or ol tags. Make sure the html is correct and the try again! Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM