Why is the div not showing up below the navbar div next to it?

Hello, I'm struggling as an amateur to figure out why the #sponsorBar div is not displaying below the navbar div. Any assistance would be greatly appreciated. Please let me know if you require more information.

body {
  background-color:black;
  margin:0;
  padding:0;
}

#navBar {
  position:fixed;
  float:left;
  background-color:white;
  text-align:center;
  height: 50px;
  width:100%;
  margin:0;
  padding:0;
  top:0;
}

#navList {
  display:inline-block;
  list-style-type: none;
  margin: 0;
  padding: 0;
  background-color:white;
}

#navList li {
  float:left;
}

#navList li:nth-child(1) {
  border-left: 0;
}

#navList li:nth-child(3) {
  margin-right: 100px;
}

#navList li:nth-child(5) {
  margin-left: 100px;
}

#navList li:nth-child(7) {
  border-right: 0;
}

#navList li a {
  display:inline-block;
  font-family:'Helvetica Neue', Helvetica, sans-serif;
  font-weight:bold;
  text-decoration:none;
  color:black;
  font-size:1.2em;
  vertical-align:-17px;
  margin: 0;
  padding: 0;
  height:50px;
}

#navList li:hover {
  background-color: black;
}

#navList li:hover a {
  color:white;
}

.navImage {
  float:left;
  display:block;
  margin:0;
  padding:0;
  max-height: 50px;
}
.navImage:hover {
  background-color: white;
}

.navListItem_left {
  border-left: 1px solid black;
  height: 50px;
  width:100px;
}

.navListItem_right {
  border-right: 1px solid black;
  height: 50px;
  width:100px;
}

#sponsorBar {
  clear:left;
  position:relative;
  display:block;
  background-color:white;
  height:100px;
  width:80%;
  margin:100px;
}
<div id="navBar">
  <ul id="navList" class="navListItem">
    <li class="navListItem_left">
      <a href="index.html">Home</a>
    </li>
    <li class="navListItem_left">
      <a href="teams.html">Teams</a>
    </li>
    <li class="navListItem_left">
      <a href="articles.html">Articles</a>
    </li>
    <li>
      <a href="/index.html">
        <img src="img/simplify_black_transparent_500x500.gif" class="navImage"/>
      </a>
    </li>
    <li class="navListItem_right">
      <a href="menu5.html">Menu4</a>
    </li>
    <li class="navListItem_right">
      <a href="about.html">About Us</a>
    </li>
    <li class="navListItem_right">
      <a href="partners.html">Partners</a>
    </li>
  </ul>
</div>
<!--Sponsor Div-->
<div id="sponsorBar">
  <p style="color:red;">TEST</p>
</div>

https://jsfiddle.net/abelgoodwin1988/a6tthq9k/

Answer №1

Well, that was quite bizarre! JSFiddle seemed to have an issue with the id "sponsorBar" for some unknown reason. It's a mystery why it didn't work. However, changing the id (and updating the corresponding CSS code) to sB did the trick without any problems!

Check out the revised code here HTML:

<body>
    <!--Navigation Div-->
    <div id="navBar">
        <ul id="navList" class="navListItem">
            <li class="navListItem_left">
                <a href="index.html">Home</a>
            </li>
            <li class="navListItem_left">
                <a href="teams.html">Teams</a>
            </li>
            <li class="navListItem_left">
                <a href="articles.html">Articles</a>
            </li>
            <li>
                <a href="/index.html">
                    <img src="img/simplify_black_transparent_500x500.gif" class="navImage"/>
                </a>
            </li>
            <li class="navListItem_right">
                <a href="menu5.html">Menu4</a>
            </li>
            <li class="navListItem_right">
                <a href="about.html">About Us</a>
            </li>
            <li class="navListItem_right">
                <a href="partners.html">Partners</a>
            </li>
        </ul>
    </div>
    <!--Sponsor Div-->
    <div id="sB">
        <p style="color:red;">TEST</p>
    </div>
    <!--Content Div-->
</body>

CSS:

 body {
        background-color:black;
        margin:0;
        padding:0;
    }

    #navBar {
        position:fixed;
        float:left;

        background-color:white;
        text-align:center;

        height: 50px;
        width:100%;

        margin:0;
        padding:0;

        top:0;
    }

    #navList {
        display:inline-block;
        list-style-type: none;
        margin: 0;
        padding: 0;
        background-color:white;
    }
    #navList li {
        float:left;
    }
    #navList li:nth-child(1) {
        border-left: 0;
    }
    #navList li:nth-child(3) {
        margin-right: 100px;
    }
    #navList li:nth-child(5) {
        margin-left: 100px;
    }
    #navList li:nth-child(7) {
        border-right: 0;
    }
    #navList li a {
        display:inline-block;
        font-family:'Helvetica Neue', Helvetica, sans-serif;
        font-weight:bold;
        text-decoration:none;
        color:black;
        font-size:1.2em;

        vertical-align:-17px;

        margin: 0;
        padding: 0;

        height:50px;
    }

    #navList li:hover {
        background-color: black;
    }
    #navList li:hover a {
        color:white;
    }

    .navImage {
        float:left;
        display:block;
        margin:0;
        padding:0;

        max-height: 50px;
    }
    .navImage:hover {
        background-color: white;
    }

    .navListItem_left {
        border-left: 1px solid black;
        height: 50px;
        width:100px;

    }

    .navListItem_right {
        border-right: 1px solid black;
        height: 50px;
        width:100px;
    }

    #sB {
        clear:left;
        position:relative;
        display:block;

        background-color:white;

        height:100px;
        width:80%;

        margin:100px;
    }

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

What steps can be taken to modify the style of a single button belonging to a broader group of elements?

Is there a way to hide the save button within a Vue Modal without affecting other buttons with the same class? .btn.btn-primary { display: none; } Simply targeting .btn-primary in the CSS affects all elements with that class, and adding .modal woul ...

What is causing the script to not execute properly?

Currently, I am in the process of working on a WordPress website and would like to incorporate some JavaScript code into one of the articles. However, for some reason, the code is not functioning as expected. <!DOCTYPE html> <html> <body> ...

How to Place Content Below a Fixed Navigation Bar?

Is there a way to insert content below a fixed navigation bar without relying on the margin-top property? Any alternative solutions? I experimented with position: relative and the top property, but I'm looking for a different approach. ...

What is the best way to manage updates to numeric inputs using jQuery?

I'm currently working on implementing a checkout menu using jQuery and HTML, but I'm facing an issue with the input box that controls the item quantity. Whenever I manually change the input value, the 'price' variable displays as "NaN". ...

Is it possible to use multiple :before pseudo-elements on a single element?

Is it feasible to have several :before pseudos for one element simultaneously? .circle:before { content: "\25CF"; font-size: 19px; } .now:before{ content: "Now"; font-size: 19px; color: black; } In my attempt to implement the afo ...

Is the background color not being implemented?

I'm struggling with an issue - I can't seem to apply a background color to my top bar. I've tried multiple times but it's still not working. Could you please help me fix this error? https://i.sstatic.net/mzJIo.png Below is the code fo ...

Having trouble with a basic image carousel function?

Currently in the process of developing a basic image carousel for a practice website I'm working on. I've been following this tutorial on YouTube. At the 7:10 mark, the tutorial demonstrates the specific function that I need help with. The tuto ...

Selenium: Perform a click action on a button enclosed within a "<div><a></a></div>" tag

I attempted to click on a button and encountered this structure: https://i.sstatic.net/GyGk3.jpg <div class="button-wrapper" id="button-verify-wrapper"> <a x-ng-click="verifySfdcConnection()" class="clearfix float-left button-green"> ...

What's the best way to display navigation menu items exclusively for mobile view?

When viewing my navbar on desktop, it appears like this: The mobile display is working perfectly. I am looking to have the items in the navbar displayed one by one on desktop and remove the menu icon entirely. This is my current code: <nav class="na ...

Creating an infinite number of dropdown select boxes using jQuery and Ajax, with options that change

I have a table set up to categorize items: | category_id | category_name | parent_id | 1 | Clothing | 0 | 2 | Shoes | 1 | 3 | T-shirts | 1 | 4 | Sneakers | 2 | 5 | Sandals | 2 ...

Retrieve all corresponding CSS values from the provided string

I have a CSS file in Shopify with the following styles: @font-face{font-family:"Work Sans";font-weight:600;font-style:normal;src:url("https://fonts.shopifycdn.com/work_sans/worksans_n6.136d99375282ffb6ea8c3dc4a8fe189c7be691b2.woff2?&hmac=xxxxxxxxxx") ...

Attempting to retrieve data from a Postman API and then utilizing the map function to display the elements of the array. However, an error message is indicating that

The API receives a JSON object that has an array of objects. We then extract this array and send it down to the component below as a prop called props.users. import React, { Component } from 'react'; import UserCard from '../components/User ...

Seeking assistance with the manipulation of divs based on the width of the screen for hiding

Recently, I encountered an issue with changing a 3x3 image gallery layout to an image slider when the screen size was less than 768px (mobile). Thanks to the help of everyone and particularly Danilo, who provided solutions in the comments, I was able to id ...

Creating a personalized inline MailChimp form

Check out this Code Pen link. My company's website has an opt-in form but it's not aligning properly. I want the name, email, and subscribe fields to be on the same line. Any suggestions? I suspect there might be a conflict with bootstrap. HT ...

CSS media query that prioritizes styling for large screens over small screens

I am currently working on making my new website development project mobile responsive, but I am encountering some strange behavior that is quite frustrating. I am hoping someone can help me figure out what mistake I may be making here. Whenever I test the ...

When attempting to call a function after an unsuccessful AJAX load, the Jquery

Our catalog results page includes an external JavaScript file that utilizes AJAX - I have a jQuery function designed to change the color of a span when it detects specific text. You can view the code below: function ReInitStockColor(){ $(function() { ...

Changing color schemes in bootstrap using class overrides vs. individually editing numerous .css files

I am aiming to customize the nav-pills to appear in a bold red color. After reviewing information on these two pages https://getbootstrap.com/docs/4.4/utilities/colors/#background-color https://getbootstrap.com/docs/4.4/components/buttons/ I gathered t ...

Why is Firefox failing to update the text and background colors when selected, as it should? Unlike Chrome, Firefox is not displaying the correct colors

main section { cursor: default; background-color: #479097; border: 1px solid #000; padding: 2px; margin: 15px 5px 15px 5px; font-size: 20px; text-shadow: 1px -1px 0 #000; } main section::selection { color: inherit; ...

When the window size is reduced, the image continues into the next div

I need to create a page that displays text alongside an image. However, when the window size is minimized, the image overlaps with the text. Here is how it looks: https://i.sstatic.net/CBMh8.png To fix this issue, I am using the following HTML code: ...

Comparing Flexbox Wrapping Behavior in Chrome and Firefox

Hey there! I'm currently grappling with ensuring that this (3-3) flexbox layout appears consistently on both Chrome and Firefox browsers. If you'd like to see a functioning example of what I'm trying to achieve (three columns and two rows) ...