The Bootstrap navigation bar lacks responsiveness

Currently, I am in the process of learning bootstrap but encountering some difficulties. The website appears normal on a computer screen but displays differently on a phone. Specifically, the navbar is not as responsive as desired. Here is an example: http://gyazo.com/38234d9e9d9e9dc5dc81903427bb455b. The image seems to be going under the navbar. Any suggestions on how to address this issue?

You can view the website here:

This snippet shows my current navbar code:

<!-- Navigation -->
    <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>


            </div>
            
            <div class="collapse navbar-collapse navbar-right pull-right" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li>
                        <a href="index.html">Home</a>
                    </li>
                    <li>
                        <a href="services.html">Services</a>
                    </li>
                    <li>
                        <a href="about.html">About Us</a>
                    </li>
                    
                    // Additional dropdown menu items
                    
                    <li>
                        <a href="contact.html">Contact</a>
                    </li>
                </ul>
            </div>
            
        </div>
    </nav>

In addition, here is the CSS related to the navbar:

.navbar .nav > li > a {
    font-family: Montserrat,"Helvetica Neue",Helvetica,Arial,sans-serif;

    float: none;
    line-height: 19px;
    padding: 9px 10px 11px;
    text-decoration: none;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
    color:  white;
    font-size:      1.2em;
}
.navbar-inverse{
    background:rgba(0,0,0,0.2);
    border-radius: 5px;
    border-bottom: none;

}
@media only screen and (max-width: 766px) {
.collapsing, .in {background-color: #f7f7f7;}
.collapsing ul li a, .in ul li a {color: #555!important;}
.collapsing ul li a:hover, .in ul li a:hover {color: #f1f1f1!important;}
}

Answer №1

Here's a handy CSS snippet to ensure your navbar doesn't overlap your image:

@media (max-width: 768px) {
  body  {
    margin-top: 50px;
  }
}

But remember, the content will still go under your navbar when you scroll on mobile devices. To prevent this, simply remove the opacity of the navbar like so:

@media (max-width: 768px)  {
  .navbar-inverse  {
    background:rgba(0,0,0,1);
  }
}

Answer №2

It seems like you're asking about the logo showing up below your navigation bar. To fix this, try adjusting the margin of the logo (specifically in the css for "img#teenused" on line 164). Check out this image for reference

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

Seeking a way to keep the returned Ajax string consistent and prevent it from fading away after page transition

I have a form that appears when the user clicks on the "Edit" link, allowing them to input their profile information. Upon submission, the data is processed via Ajax and saved in an SQL database using a PHP script. After saving the new profile, I would lik ...

Tips on choosing vml elements using jquery or vanilla javascript

I am trying to select a VML element using jQuery without relying on 'id' or 'class', but my attempts have been unsuccessful so far. <v:oval id="vmlElement" style='width:100pt;height:75pt' fillcolor="red"> </v:oval> ...

When the value is removed, it does not revert back to the initial filtered choices

After clearing the input, I want to display all the original li's again. The issue is that even though .value = '' clears the input, the filter remains active. I could really use some help with this as it's starting to get on my nerves ...

Branding image from Bootstrap overlapped with a container situated below the navigation bar

I'm having trouble adding a 400 x 100 png logo as a Navbar Brand image in Bootstrap 5. The logo is appearing too large, and even when I try to resize it, it still overlaps the black container and text input box below the Navbar in desktop view. On mob ...

What are the available choices for constructing HTML based on an ajax response?

Are there any alternatives or libraries available for constructing html from an ajax response? Currently, I am taking the json data received, creating the html as a string, and using a jQuery function to insert it into the DOM. However, I believe there mu ...

Tips for resolving HTML issues in AJAX Client Side-templates from WCF-webservice

I am facing an issue with my templates where the returned HTML is encoded by default, and despite my efforts, I can't seem to find a solution. My goal is to substitute NewLines (\u000a) with a simple <br />, but every attempt results in &a ...

Utilizing media queries to customize the appearance of a jQuery accordion widget

Hello, I'm struggling with implementing a jQuery accordion for mobile platforms that destroys itself on larger screens. While my code is mostly working, I've encountered two issues: The accordion only gets destroyed when the window is resized ...

A guide on creating a downward animation of an object using CSS3

I am currently working on practicing CSS 3 animation. I am facing a challenge in figuring out how to make the item fall down the page at full speed without needing the user to track it downward with the mouse, all without using javascript. Ideally, I want ...

Guide to changing the background colors of multiple elements when hovered over by the mouse?

I want to customize my website's search bar by changing the background color when it is hovered over. Currently, the search bar has two main elements: the text box and the submit button. I have successfully programmed the text box element to change to ...

Ways to monitor the scores in Player versus Computer matchups

I'm currently working on my first coding challenge and I must admit, as a beginner in coding, I'm struggling with creating a scorecard to track the player versus computer score over a certain number of games. I've tried various methods, inc ...

Safari's compatibility issues with Next.js Images are preventing Flexbox from working properly

I'm trying to lay out Next.js Images using flex-wrap with a fixed height but variable width based on the image. I'm utilizing tailwind for this project. Everything is working perfectly on Google Chrome as expected. https://i.sstatic.net/KTTx9.j ...

Is there a variation in HTML/XHTML/XML code based on different geographic regions?

I have a question regarding the consistency of HTML, XHTML, and XML code across different localizations. If I write code on a system using the "en-us" localization, will it remain the same when rendered on a system with the "sv-SE" localization? For examp ...

How can I apply column spacing specifically for both desktop and mobile devices using only Bootstrap 4?

I am struggling to create a 15px gap between two rows and columns on both desktop and mobile using bootstrap. I know there is something with margins, but I can't figure out the best way to implement it. For the second row, I want two columns to appea ...

resizing problem with images that adapt to different screen sizes

I've been working on creating a responsive website, but I'm having trouble with the resizing of the two background images I added to the header. When I view the site on a mobile device, the header appears squashed. I think this might be because I ...

Display a list of personalized post types and emphasize the item that is currently being viewed

I've created a unique type of post called 'product'. Every product page has a sidebar listing all products, with the current product displayed in bold text. For instance, when viewing product 3, it should appear like this: Sidebar Pr ...

What is the best way to position text on top of a deck of cards?

looking for this current status this is my code: <div class="card-deck test"> <div class="card-group mx-auto test2"> <div class="d-flex align-items-start overviewHeader"> <h2>O ...

What is the best way to remove a border piece with CSS?

Currently, I'm attempting to achieve a matrix effect purely through HTML and CSS. One method I have come across involves applying a solid border and then removing certain parts at the top and bottom. Does anyone know if it's possible to create th ...

After the initial jQuery ajax request, the jQuery formatting adjustments are reverted back to their

It seems like there are others facing similar issues without finding a solution. Here is the situation: The user clicks a button to reveal a hidden div that contains a textarea for making comments: //revealing the textarea-containing div $('#postTyp ...

Fade all list items other than the one that is selected

I have a group of items in a list. Whenever you click on an item, it expands to show more information. I would like all other items in the list to be blurred except for the one that is expanded. <li href="#" class="list-group-item" ng-repeat="task in t ...

What is the best way to use CSS to evenly lay out a group of dynamically generated buttons?

My Vue-generated buttons need to be evenly laid out on the bottom of the page, with equal space on the left and right. The mdui button style I am using has fixed width and height, so I have to decide between a single row for fewer buttons (less than three ...