On smaller screens, the dropup menu on the fixed bottom navbar seamlessly drops down into the navbar

Issue

Almost done with my navbar (see code below), but the "Username" dropdown isn't behaving as expected. On larger screens it drops up, which is great, but on smaller screens it's dropping down into the navbar. If you resize the page, you'll see what I mean. Any ideas how to make it drop up on smaller screens too?

Code

<!DOCTYPE html>
<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">
    <title>Navbar</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> 
    <style type="text/css">
    body {margin:70px 20px}

    .navbar-nav {
float: none;
text-align: center;
}
    ......
    </style>
</head>
<header>
    <nav class="navbar navbar-default navbar-fixed-top" role="navigation">          
        <div>
            <ul class="nav navbar-nav">
                <li class="nav-item active"><a href="index.html" id="PostsLink">Posts</a><li>
                <li class="nav-item"><a href="submit.html" id="SubmitPostLink">Submit</a></li>
                <li class="nav-item"><a href="buy.html" id="BuyLink">Buy</a></li>
                <li class="nav-item inlinee"><a href="about_us.html" id="ContactUsLink">About Us</a></li>
            </ul>
        </div>
    ......
        </ul>
        </div>
    ......
    </body>
</html>     

Your help in resolving this issue would be highly appreciated and will bring my project closer to completion.

Answer №1

Check out this jsfiddle (click run): https://jsfiddle.net/g3x8PnAm/

I made some modifications to your code, specifically changing the classes navbar-nav and nav-item to navbar-nav-special and nav-item-special respectively. This change ensures that only your custom styles are applied without interference from any existing Bootstrap styles. However, there seems to be an issue with the popup being cut off on small screens. You may need to adjust the padding for the Username item or explore other solutions. I'll continue to work on adjusting the padding and will update this post accordingly. Here's a snippet of the updated code from the fiddle:

<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">
<title>Navbar</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> 
<style type="text/css">
body {margin:70px 20px}

.navbar-nav-special {
float: none;
text-align: center;
}

.navbar-nav-special li {
float: none;
display: inline-block;
}

.mrmb {
margin-right:20px;
margin-top:-10px;
}

.nav-item-special {
height:100%;
width:20%;
}

.nav-itemm {
height:100%;
width:23%;
}

#navigation ul li {
display: inline;
padding:50px;
}

.inlinee{
white-space: nowrap;
}

.btn-group{
margin:10px;
}
</style>
</head>
<header>
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">          
    <div>
        <ul class="nav navbar-nav-special">
            <li class="nav-item-special active"><a href="index.html" id="PostsLink">Posts</a><li>
            <li class="nav-item-special"><a href="submit.html" id="SubmitPostLink">Submit</a></li>
            <li class="nav-item-special"><a href="buy.html" id="BuyLink">Buy</a></li>
            <li class="nav-item-special inlinee"><a href="about_us.html" id="ContactUsLink">About Us</a></li>
        </ul>
    </div>
</nav>
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
    <div>
        <ul class="nav navbar-nav-special" style="margin-left:25%; margin-right:-25%;">
            <li class="nav-itemm"><a href="register.html" id="RegisterLink">Register</a></li>
            <li class="dropdown nav-itemm">
                <a href="#" data-toggle="dropdown" class="dropdown-toggle" id="UserControls">Username</a>
                <ul class="dropdown-menu">
                    <li><a href="view_posts.html" id="ViewPostsLink">View Posts</a></li>
                    <li><a href="change_email.html" id="ChangeEmailLink">Change Email</a></li>
                    <li><a href="change_password.html" id="ChangePasswordLink">Change Password</a></li>
                    <li><a href="log_out.html" id="LogOutLink">Log Out</a></li>
                </ul>
            </li>
        </ul>
    </div>
</nav>
</header>
<body>
</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

Looking to replace a background image using javascript?

(apologies for any language mistakes) I have multiple divs with a common background image. I assigned them the same class and set the background image using CSS in style.css which worked perfectly fine. Now, I want to change the background image dynamical ...

What is the method to submit to a protected service from an unsecured page without relying on a complete domain name?

I am interested in creating a form on a non-secure page without the need for a fully qualified domain name. http://www.example.com/page This form should post to a secure service on the same domain. https://www.example.com/service I currently have a wor ...

What are some best practices for utilizing `element.offsetParent` in HTML SVG elements?

I'm currently updating some JavaScript code that relies on the .offsetParent property. The recent changes in the application involve the use of SVG elements, which are causing issues with the JavaScript as mySvgElement.offsetParent always returns unde ...

Parallax scrolling within a div creates a dynamic visual effect

Hello there, thank you for taking the time to read this. I am currently working on a website and encountering some challenges while trying to implement a specific effect. I am aiming to achieve a parallax effect similar to what can be seen on this page. As ...

Include some extra margin or padding to ensure the section is visible below the fixed navbar

I have implemented smooth scrolling using scroll-behavior: smooth in my CSS. The navigation bar is sticky, and when I click on a menu item, it takes me to the designated section. The issue I am facing is that the section goes under the sticky navbar. I wo ...

Revamp every single hyperlink that ends in .html

I am looking to customize the URLs on my website to appear like this: www.example.html/1 www.example.html/2 www.example.html/3 instead of their current format: www.example.html/1.html www.example.html/2.html www.example.html/3.html Can anyone provide a ...

What is the best way to align these two divs centrally within a container set to display as inline-block?

I can't seem to get these two floated left divs centered within a container that has a height set to auto and a display of inline-block. The container has a max-width of 1600px, but when the window is stretched wider than that, it stays aligned to the ...

Error! Uploading files with Danish characters in their file names causes a problem

Currently, I am utilizing a third party API called Podio to successfully upload files through its functions. The only issue I have encountered is when trying to upload a file named "Skærmbillede.jpg," I receive the following error: Fatal error: Uncaught ...

Transmit data from Raspberry Pi to Apache Server with strong security measures

Utilizing a Raspberry Pi to collect temperature data and store it in a file Running on a virtual machine, the server uses Apache to host a website (comprised of HTML, PHP, and JavaScript) displaying a graph based on this data I am seeking a secure method ...

The Google Match Content Ad is adapting to larger screen resolutions in order to optimize its display

We've encountered a few problems with Google matched content ads and Bootstrap 4. 1) In larger resolutions, the ad attempts to adjust to the container size: https://gyazo.com/1f7f485f4a0dd91e33e69aaf41af2412 I've experimented with setting a fix ...

Issues arise when dealing with a CSS and HTML accordion

I decided to create a CSS and HTML collapsing menu system, also known as an accordion. I found a tutorial on how to do it here. However, I had to make some modifications because I wanted to include images in the 'sections' later on. Instead of us ...

Elements in Bootstrap Container class failing to align properly

Hello Everyone, I am attempting to achieve the same layout as demonstrated in [original image] where the "browse collection" div and the "request brochure" div are aligned with the four items above them. My approach involves using Bootstrap, and I assume ...

Determine the width of two inline input fields

Showing two inputs side by side: +------------+ +--------------------------+ | ID='inputA'| | ID='inputB' | +------------+ +--------------------------+ +------------------------------------------+ A ...

Tips for concealing a submit button in CodeIgniter

Is it possible to hide the submit button if the completion status is 'completed'? Here is a snippet of my code: <input type="submit" <?=($row[ 'checklist_id']=="Denied" ||$row[ 'checklist_id']=="Approved" ||$row[ &apos ...

Having problems with the functionality of AngularJS Routes

I just started learning AngularJS, and I'm having trouble with my routes. I've tried searching on Google and implementing various solutions, but nothing seems to be working. Here is a snippet from my index.html file located in public/index.html: ...

The carousel caption in Bootstrap 5 vanishes when viewing the website on a smaller device

Currently, I'm dealing with an issue using bootstrap carousel code. The carousel text displays properly on desktop screens but disappears when viewed on smaller sized screens. It appears that the text is being hidden behind the image. Various attempts ...

Elevate column to top position in mobile display with Bootstrap

I am currently working with Bootstrap column classes and have set up four columns as follows: <div class="col-md-3"> @include('schedulizer.classes-panel') @include('schedulizer.time-span-options-panel') @include(&apos ...

Once appearing, the element quickly vanishes after the fadeIn() function is

In the source code, there is a section that looks like this: <div class="dash page" id="home"> <?php include ('pages/home.php'); ?> </div> <div class="dash page" id="screenshots"> <?php include ('pages/scr ...

The program waited for 60 seconds for the element to become clickable in the Selenium webdriver, but it timed out

I am currently working on Selenium web driver and trying to locate the element with the ID visualizationId, but I keep encountering an error. Below is the code snippet where the error occurs: Actions actions1 = new Actions(driver); WebElement dBox1= ((new ...

Is the Bootstrap popover triggering the same action/event twice?

Have you ever encountered the issue of Bootstrap's popover repeating an action twice? It can be frustrating, especially when trying to submit a form inside the popover's data-content using AJAX. The form data gets repeated twice and the form is p ...