2017-05-02 10:11
浏览 16


I am having an issue with my bootstrap navbar. I would like to divide the content where the categories are on the left and the log in details are on the left.

For example: Brädspel Samlarkortspel Figurspel Tillbehör list stays on the left while: Registrera Logga in Önskelista (0) Kundvagn Kassan stays on the right. I have tried using <ul class="nav navbar-nav navbar-right"> However it dosent work properly. Here is the whole website navbar:

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<!-- Optional theme -->
<link rel="stylesheet" href="" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

<!-- Latest compiled and minified JavaScript -->
<script src="" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

<a href="index.php"><img src="image/samspel.png" alt="mainlogo" class="img-responsive center-block" height="200px" width="200px"></a>
<?php if ($categories) { ?>
<div class="container">
  <nav id="menu" class="navbar">

    <div class="navbar-header"><span id="category" class="visible-xs"><?php echo $text_category; ?></span>
      <button type="button" class="btn btn-navbar navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"><i class="fa fa-bars"></i></button>
    <div class="collapse navbar-collapse navbar-ex1-collapse">
      <ul class="nav navbar-nav">
            if (isset($_GET['path'])) {
              $parts = explode('_', (string)$_GET['path']);
            } else {
              $parts = array();

            if (isset($parts[0])) {
              $category_id = $parts[0];
        <?php foreach ($categories as $category) { ?>
        <?php if (isset($category_id) && isset($category['category_id']) && $category['category_id'] == $category_id) { ?>
        <li name="<?php echo $category['name']; ?>" class="open"><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></li>
        <?php } else { ?>
        <li name="<?php echo $category['name']; ?>"><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></li>
        <?php } ?>
        <?php } ?>
          <?php echo $currency; ?>
          <?php echo $language; ?>
                  <?php if ($logged) { ?>

                  <li><a href="<?php echo $account; ?>"><?php echo $text_account; ?></a></li>
                  <li><a href="<?php echo $order; ?>"><?php echo $text_order; ?></a></li>

                  <li><a href="<?php echo $transaction; ?>"><?php echo $text_transaction; ?></a></li>
                  <li><a href="<?php echo $download; ?>"><?php echo $text_download; ?></a></li>
                  <li><a href="<?php echo $logout; ?>"><?php echo $text_logout; ?></a></li>
                  <?php } else { ?>
                  <li><a href="<?php echo $register; ?>"><?php echo $text_register; ?></a></li>
                  <li><a href="<?php echo $login; ?>"><?php echo $text_login; ?></a></li>
                  <?php } ?>
              <li><a href="<?php echo $wishlist; ?>" id="wishlist-total" title="<?php echo $text_wishlist; ?>"><i class="fa fa-heart"></i> <span class="hidden-xs hidden-sm hidden-md"><?php echo $text_wishlist; ?></span></a></li>
              <li><a href="<?php echo $shopping_cart; ?>" title="<?php echo $text_shopping_cart; ?>"><i class="fa fa-shopping-cart"></i> <span class="hidden-xs hidden-sm hidden-md"><?php echo $text_shopping_cart; ?></span></a></li>
              <li><a href="<?php echo $checkout; ?>" title="<?php echo $text_checkout; ?>"><i class="fa fa-share"></i> <span class="hidden-xs hidden-sm hidden-md"><?php echo $text_checkout; ?></span></a></li>
<?php } ?>

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dpgu5074 2017-05-02 11:38

    make a structure like this, and you have done

    <link href="" rel="stylesheet"/>
    <script src=""></script>
    <script src=""></script>
    <nav class="navbar navbar-inverse">
      <div class="container-fluid">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>                        
          <a class="navbar-brand" href="#">WebSiteName</a>
        <div class="collapse navbar-collapse" id="myNavbar">
          <ul class="nav navbar-nav">
              <li><a href="#">Brädspel</a></li>
           <li><a href="#">Samlarkortspel</a></li>
           <li><a href="#">Figurspel</a></li>
            <li><a href="#">Tillbehör</a></li>
          <ul class="nav navbar-nav navbar-right">
        <li class=""><a href="#">Registrera</a></li>
            <li class=""><a href="#">Logga in</a></li>
              <li class=""><a href="#">  Önskelista (0)</a></li>
            <li class=""><a href="#">Kundvagn</a></li>
              <li class=""><a href="#">Kassan</a></li>

    解决 无用
    打赏 举报

相关推荐 更多相似问题