Issues with both horizontal and vertical bootstrap navigation bars functionality

My attempt to incorporate both a vertical and horizontal Bootstrap menu on my webpage led to the layout being disrupted. Is there a solution for this issue? Below is the code for my horizontal menu:

<html lang="en"><head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Bootstrap core CSS -->
    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
  </head>

  <body>

    <!-- Fixed navbar -->
    <div class="navbar navbar-default navbar-fixed-top" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="home.php">Company</a>
        </div>
        <div class="navbar-collapse collapse">
          <ul class="nav navbar-nav">
            <li class="active"><a href="home.php"><i class="glyphicon glyphicon-home"></i><span>&nbsp;Home</span></a></li>
            <li><a href="order.php"><i class="glyphicon glyphicon-pencil"></i><span>&nbsp;Order</span></a></li>
            <li><a href="cart.php"><i class="glyphicon glyphicon-shopping-cart"></i><span>&nbsp;Cart</span></a></li>
            <li><a href="contactus.php"><i class="glyphicon glyphicon-earphone"></i><span>&nbsp;Contact Us</span></a></li>
            <li><a href="about.php"><i class="glyphicon glyphicon-search"></i><span>&nbsp;About Us</span></a></li>
          </ul>
          <ul class="nav navbar-nav navbar-right">
            <li><a href="register.php"><i class="glyphicon glyphicon-registration-mark"></i><span>&nbsp;Register</span></a></li>
            <li class="active"><a href="login.php"><i class="glyphicon glyphicon-user"></i><span>&nbsp;Login</span></a></li>
          </ul>
        </div><!--/.nav-collapse -->
      </div>
    </div>


    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script src="bootstrap/js/bootstrap.min.js"></script>


</body>
</html>

Following is the code for my vertical menu.

<html lang="en"><head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8"> 
        <meta charset="utf-8">
        <meta name="generator" content="Bootply">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">

        <!-- CSS code from Bootply.com editor -->

        <style type="text/css">
            @media (min-width: 768px) {
  .navbar-collapse {
    height: auto;
    border-top: 0;
    box-shadow: none;
    max-height: none;
    padding-left:0;
    padding-right:0;
  }
  .navbar-collapse.collapse {
    display: block !important;
    width: auto !important;
    padding-bottom: 0;
    overflow: visible !important;
  }
  .navbar-collapse.in {
    overflow-x: visible;
  }

.navbar
{
    max-width:200px;
    margin-right: 0;
    margin-left: 0;
    margin-top:200px;
}   

.navbar-nav,
.navbar-nav > li,
.navbar-left,
.navbar-right,
.navbar-header
{float:none !important;}

.navbar-right .dropdown-menu {left:0;right:auto;}
.navbar-collapse .navbar-nav.navbar-right:last-child {
    margin-right: 0;
    margin-top:200;
}
}
        </style>
    </head>

    <!-- HTML code from Bootply.com editor -->

    <body>

<nav class="navbar navbar-default" role="navigation">


  <!-- Collect the nav links, forms, and other content for toggling -->
  <div class="collapse navbar-collapse navbar-ex1-collapse">
    <ul class="nav navbar-nav">
      <li class="active"><a href="breads.php">Breads</a></li>
      <li><a href="cupcakes.php">Cupcakes</a></li>
      <li><a href="pies.php">Pies</a></li>
      <li><a href="pastas.php">Pastas</a></li>
      <li><a href="desserts.php">Desserts</a></li>
      <li><a href="caters.php">Caters</a></li>
    </ul>
  </div><!-- /.navbar-collapse -->
</nav>


</body></html>

I would like to include them here.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Categories - Breads</title>

</head>
<body>

<?php include_once("hor_menu.php");?>   
<?php include_once("vert_menu.php");?>

</body>
</html>

Is it feasible to include both files without causing layout issues?

Answer №1

Consider using this code snippet (not yet validated)

<html lang="en"><head>
    <meta charset="utf-8>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Bootstrap core CSS -->
    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">

        <style type="text/css">
            @media (min-width: 768px) {
  .navbar-collapse {
    height: auto;
    border-top: 0;
    box-shadow: none;
    max-height: none;
    padding-left:0;
    padding-right:0;
  }
  .navbar-collapse.collapse {
    display: block !important;
    width: auto !important;
    padding-bottom: 0;
    overflow: visible !important;
  }
  .navbar-collapse.in {
    overflow-x: visible;
  }

.navbar
{
    max-width:300px;
    margin-right: 0;
    margin-left: 0;
    margin-top:150px;
}   

.navbar-nav,
.navbar-nav > li,
.navbar-left,
.navbar-right,
.navbar-header
{float:none !important;}

.navbar-right .dropdown-menu {left:0;right:auto;}
.navbar-collapse .navbar-nav.navbar-right:last-child {
    margin-right: 0;
    margin-top:200;
}
}
        </style>

  </head>

  <body>

    <!-- Fixed navbar -->
    <div class="navbar navbar-default navbar-fixed-top" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="home.php">Company</a>
        </div>
        <div class="navbar-collapse collapse">
          <ul class="nav navbar-nav">
            <li class="active"><a href="home.php"><i class="glyphicon glyphicon-home"></i><span>&nbsp;Home</span></a></li>
            <li><a href="order.php"><i class="glyphicon glyphicon-pencil"></i><span>&nbsp;Order</span></a></li>
            <li><a href="cart.php"><i class="glyphicon glyphicon-shopping-cart"></i><span>&nbsp;Cart</span></a></li>
            <li><a href="contactus.php"><i class="glyphicon glyphicon-earphone"></i><span>&nbsp;Contact Us</span></a></li>
            <li><a href="about.php"><i class="glyphicon glyphicon-search"></i><span>&nbsp;About Us</span></a></li>
          </ul>
          <ul class="nav navbar-nav navbar-right">
            <li><a href="register.php"><i class="glyphicon glyphicon-registration-mark"></i><span>&nbsp;Register</span></a></li>
            <li class="active"><a href="login.php"><i class="glyphicon glyphicon-user"></i><span>&nbsp;Login</span></a></li>
          </ul>
        </div><!--/.nav-collapse -->
      </div>
    </div>


<nav class="navbar navbar-default" role="navigation">


  <!-- Collect the nav links, forms, and other content for toggling -->
  <div class="collapse navbar-collapse navbar-ex1-collapse">
    <ul class="nav navbar-nav">
      <li class="active"><a href="breads.php">Breads</a></li>
      <li><a href="cupcakes.php">Cupcakes</a></li>
      <li><a href="pies.php">Pies</a></li>
      <li><a href="pastas.php">Pastas</a></li>
      <li><a href="desserts.php">Desserts</a></li>
      <li><a href="caters.php">Caters</a></li>
    </ul>
  </div><!-- /.navbar-collapse -->
</nav>




    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script src="bootstrap/js/bootstrap.min.js"></script>


</body>
</html>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Drawing on Canvas with Html5, shifting canvas results in significant issues

I've been working on developing an HTML5 drawing app, and while I have all the functionality sorted out, I'm facing challenges during the design phase. My main issue is centered around trying to make everything look visually appealing. Specifical ...

Instructions for concealing and revealing a label and its corresponding field before and after making a choice from a dropdown menu

Currently, I am working on developing a form that will enable customers to input their order information. This form includes a selection list for payment methods, with three available options. If the user chooses either credit or debit card as the paymen ...

Reposition and resize an image. Creating a grid layout

I'm having trouble with positioning and cropping an image correctly on my website. I want it to look like this (hero-section): The entire project is based on a grid layout. I need a circular image that is larger than the container, positioned to the ...

How to Align the Button Vertically with the TextField in React Material-UI

Utilizing the Material-UI library for React, I have been working on creating a simple form with the following design: https://i.stack.imgur.com/LY3ZN.png My challenge lies in aligning the button with the TextField element. Adjusting the margin-top proper ...

Tips for implementing an image as a background in AngularJS

Struggling with a Dilemma: This issue has been driving me insane for the past three days... I am eager to utilize an angularJS variable as a background image without relying on a directive. My objective is to load images of any shape (square, rectangle, ...

Issue with React-select: The background color is not extending to the full width when using wordWrap:"scroll"

I am currently implementing react-select in one of my projects. I need the wordWrap property to be set to "scroll". However, when the length of the options exceeds the menu width and I scroll to the right, the hover color does not fill the entire width. T ...

The content within the bootstrap card is not displaying correctly in its entirety

The alignment of the '.card-text' within my row of bootstrap cards is not correct. I attempted to adjust the spacing for '.card-text', but unfortunately, it did not resolve the issue. Below is the code snippet: HTML: <!DOCTYPE html& ...

Selecting HTML5 data attributes using jQuery

There is a button on my page with multiple data attributes, and I am trying to hide it by selecting it based on its class and two specific data attributes. <a href='#' class='wishlist-icon' data-wish-name='product' data-wi ...

Best Way to Eliminate "#" Symbol from URL Address in UI-Router

My website URL is structured as follows: This is the index page where I utilize Angular UI-Router to navigate to different views, however, the URL retains the hash symbol (#) like this: Query: I am looking for a way to eliminate/remove the hash tag from ...

Alert-Enabled Random Number Generation Tool

I'm struggling to create a program that randomly generates a number between 1 and 20. If the number is less than 10, it should display "fail," and if it's greater than 10, it should display "success." I can't seem to figure out where I went ...

Is it possible to make an asp:Panel extend beyond its boundaries to the right when dynamically incorporating controls into a webpage?

Currently, I am working on a solution to dynamically add controls to an asp:Panel on a website, ensuring that they all remain on the same line. Despite setting a specific width and adding overflow:auto, the controls still wrap to the next line when there i ...

Utilizing PHP loops to dynamically generate Bootstrap rows with specific column configurations for elements

My goal is to design a front-end layout using a PHP loop along with Twitter Bootstrap's 12 column grid system: https://i.sstatic.net/nvFC6.jpg This is the HTML output: <div class="row"> <div class="col-lg-4"> Content... ...

What is the best way to integrate multiple Angular2 components on a single page?

I'm currently working on fitting a couple of components to each take up a full page. I would like the first component to occupy the entire screen, similar to a landing page, and have the browser scroll bar for scrolling down to view the second compone ...

Leveraging the power of tabs in AngularJS

Utilizing tabs in angularjs and dynamically loading views. My goal is to prevent the re-loading of a view that has already been loaded, and to ensure that the controller does not run again when using $state.go. Instead, it should be set to active status. ...

Responsive breakpoints in TailwindCSS seem to have an issue with applying padding and margin styles properly

Currently, I am tackling a project that involves creating a responsive design with Tailwind CSS on nuxtjs. Has anyone encountered the issue of py-8 applying to both breakpoints? If so, please share your insights! Here is how I have structured the compone ...

What is the best way to transfer the value of a <span> element to a different <div> using jQuery or JavaScript

Is there a way to move or copy the price and insert it into the <div class="info"> using jQuery? The code I'm currently using is returning an unexpected result of "102030". jQuery(document).ready(function($) { $(document).ready ...

Bootstrap table exceeds the boundaries of the smartphone screen

I'm currently working on my first laravel project with bootstrap (https://getbootstrap.com/) and I've encountered an issue related to mobile device responsiveness. The problem arises when using a basic table in bootstrap4 (the absence of the res ...

Switch up the color of the flush list line break in Bootstrap 4

The code snippet taken from the documentation is as follows: <ul class="list-group list-group-flush"> <li class="list-group-item">Cras justo odio</li> <li class="list-group-item">Dapibus ac faci ...

The height of the navigation bar adjusts to fit the image

I'm currently struggling with my html and css learning project. The height of the navigation bar is not adjusting properly to the size of the image. I have tried various solutions, but nothing seems to work. Any guidance would be appreciated! htm ...

Incorporate imagesloaded.js into your PHP script to seamlessly import images from a designated folder

I've implemented the code below into a bootstrap modal to display images from a website folder. These images are loaded using lazyload.js when the modal is opened. Sometimes, there's a delay in displaying images depending on their sizes. I'd ...