The bootstrap navbar spreads across the entire page, yet it doesn't reach every single page

I'm currently in the process of constructing a website for a restaurant. One particularly strange issue I've encountered is that the navigation bar covers the entire page, but only on specific pages like the cart, login, and register pages. Strangely enough, it functions normally on the home page or menu page. The problem arose when I was working on the home page. Subsequently, when I attempted to navigate to the login page, the navigation bar expanded to cover the entire page. What's even more peculiar is that this behavior is limited to certain pages. I included a commented tag in the home HTML code to indicate what changes I made before the problem manifested.

Image: https://i.sstatic.net/iCZHE.png

Snippet from Home Page HTML:

    
    <head>
    <link rel="stylesheet" href="./assets/css/home-style.css"/>
</head>
<div class="container min-h main-container">
   ...
        
        **<!--This is what i added before the problem-->
       ...  
 
 </div>
    <!--Until here-->**

CSS for home page:

  ...


Header:

    <?php $categories = $this->products_model->get_all_categories();?>

...

CSS for Header:

.bg-dark{
    background-color: #000!important;
}

...

.done styling with CC everything ok now! thanks.
.container{
    width: 100%;
    height: 100%;
    min-height: 100vh;
    margin-top: 150px;
    display: flex;
}
...Maybe you should try rearranging your stylesheets or checking if there are any conflicting classes causing the navigation bar issue across different pages. Good luck!

One page that have the problem:

HTML:

<head>
    <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>/assets/css/lr-style.css"/>
</head>

...

CSS:

.container{
    width: 100%;
    height: 100%;
    min-height: 100vh;
    margin-top: 150px;
    display: flex;
}

...

Having isolated the issue, it seems like there might be some conflicting CSS rules affecting the navigation bar behavior. Double-checking your stylesheets and making sure there are no overlapping classes could help resolve the problem. Best of luck troubleshooting!

Answer №1

If you're encountering this problem, simply update the container class in Header.html to container-fluid

<nav class="navbar navbar-dark py-0 bg-dark navbar-expand-lg fixed-top">
    <div class="container">  

Change it to

<nav class="navbar navbar-dark py-0 bg-dark navbar-expand-lg fixed-top">
    <div class="container-fluid">

For code examples, check out this link - https://codepen.io/nagasai/pen/WzYwyo

The issue is caused by the container class in the header file, which inherits 100% width and height. Update it to container-fluid in header.html to resolve the problem.

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

I need to display 5 columns in a parent component, each with its own unique icon. How can I conditionally render them in a React component?

Creating a parent component to reuse multiple times can be very useful. In my case, I have included 5 different icons in each instance of the component, all taken from hero icons. I have set up an object with unique ids for each child component, but I am ...

It appears that the query parameters are impacting the speed at which the page loads

I am currently developing a project on this platform. It is using c9.io, an innovative browser-based collaborative programming IDE. The index.php file includes the following script: <?php $path = ltrim($_SERVER['REQUEST_URI'], '/&ap ...

What is the best way to limit the number of options displayed in the vue-multiselect

I'm looking to truncate multiple values on the vue-multiselect component. I attempted to override various classes without success, as shown in this example: .multiselect__content-wrapper { overflow-x: hidden; text-overflow: ellipsis; } ...

The HTML dropdown menu features my organized tabs for easy navigation

Currently, I'm developing a website for our school, and one of the features is a hoverable drop-down menu. However, I'm facing an issue where the drop-down items do not align correctly with the menu tabs when I hover over them. Attached is an i ...

Designing a unique 24-column grid system for Bootstrap 4

I'm working on a project and looking to incorporate some bootstrap elements into my HTML files for UI development. My goal is to modify the standard grid size from 12 to 24. I've read through the documentation, but I'm unsure of where exactl ...

Tips for creating responsive content within an iframe

I have inserted a player from a website that streams a channel using an iframe. While I have managed to make the iframe responsive, the video player inside the iframe does not adapt to changes in viewport size. Despite trying various solutions found online ...

Obtaining the Author's ID on Blogger

Is there a way to extract the author's ID on Google's blogger.com platform? I'm familiar with how to obtain the post ID using data:post.id, but what about the author's ID? ...

What steps can be taken to adjust the alignment of a Bootstrap Dropright menu so that it opens in an upward direction instead of the standard downward

My dropdown menu is dropping towards the right correctly, but it is going downwards and getting hidden under my page. I want it to open upwards instead of downwards. I attempted to adjust the CSS, adding bottom:0 to the dropdown-menu, but unfortunately, i ...

Graphical representation in the body of an email using bar graphs

Can a dynamic bar graph be created in an email message? It should be compatible with Outlook. I want to include a graph in an email sent using oracle database, where the dynamic values will be passed through a procedure. ...

The steps for including a delete option

I'm currently working on implementing a delete functionality for my entries. Specifically, I want to add a delete link button under the 'action' column that will remove an entry once it's clicked. Despite creating the delete.php file, I ...

Center Items in Flexbox, Implementing React Material with React

In my React App, I am utilizing flexbox and React Material to align the searchbar and clear button on the same line with space between them. Here is the link for reference: CLICK HERE <div className={classes.searchBarSection}> <Paper com ...

What is the best way to create underlined text that is either left-aligned or centered?

I am looking to replicate this specific style of decoration in a full width container. My goal is to have it aligned to the left of the text and restricted to a maximum width. https://i.stack.imgur.com/H8DXT.png ...

Adjusting the size of a button in HTML and CSS

Check out this code: /* custom button */ *, *:after, *:before { box-sizing: border-box; } .checkbox { position: relative; display: inline-block; } .checkbox:after, .checkbox:before { font-family: FontAwesome; font-feature-settings: normal; - ...

Editing the content of a div in real-time by dynamically updating the innerHTML

Looking for a way to dynamically change the innerHTML of a contentEditable div using pure JavaScript, without relying on the Rangy library. I want the change to occur on keyup without losing cursor position or focus. Here is an example setup: <div id=" ...

What is the method for emphasizing links in the navigation bar with Bootstrap 3?

I am currently working on applying custom CSS styles to the Bootstrap navbar in order to have the link text underlined when hovered over, with a fade-in effect as well. To see what I have accomplished so far, you can view it here: https://jsfiddle.net/xfd ...

How can Vue assign a distinct v-model parameter during iteration?

I need help with assigning unique parameters in a loop to each input tag using v-model. Here is the code that I have attempted: <template> <div v-for="item in lst" key="item"> <input :v-model="item"> </i ...

Include parameters for a pagination system

I have a script that fetches data from my database and generates pagination. Everything is working fine, but now I want to include a conditional statement to differentiate the user level as New, Current, or Renewing client. I've already set up some s ...

Markdown in Vue.js filters

I found a helpful example by Evan You on how to convert HTML to markdown - check it out here. However, when trying to install the marked package via npm and implementing it, I encountered an error stating that 'marked' is not defined. After inc ...

Issues are arising with the .mouseover functionality within this particular code snippet

Learning Javascript has been a challenge for me so far. I tried following a tutorial, but the result I got wasn't what I expected based on the video. I'm wondering why that is and how I can fix it. I'm aiming to make a box appear suddenly w ...

Unable to Modify Header Link Font Color

I've been struggling to change the link color of a header on my website. By default, the link color in my CSS is blue, but I want the links in my entry headers to be gold. I thought this would be a simple task - just define the link color for the hea ...