Fluid overlap of divs in Bootstrap framework

I am currently in the process of making style adjustments to a website at

One specific change I've made is adding a top bar image. However, I've encountered an issue where the top bar graphic overlaps the navigation when the page is resized too wide. My goal is to have the image push the navigation bar down instead.

The HTML structure is as follows:

<div class="navigation-wrapper">
<div class="NEON-header">
<img src="/images/banners/header_whole.png" alt="NEON" style="width:100%;">
</div>
    <div class="site-name">
        <a href="{{ site.url }}">{{ site.title }}</a>
    </div><!-- /.site-name -->
    <div class="top-navigation">
        <nav role="navigation" id="site-nav" class="nav">
            <ul>
                {% for link in site.links %}
                <li><a href="{% if link.external %}{{ link.url }}{% else %}{{ site.url }}{{ link.url }}{% endif %}" {% if link.external %}target="_blank"{% endif %}>{{ link.title }}</a></li>
                {% endfor %}
            </ul>
        </nav>
    </div><!-- /.top-navigation -->
</div><!-- /.navigation-wrapper -->

The current issue lies in the fact that the site name and top-navigation divs are concealed by the NEON-header div when the page is widened. I've attempted using the "after" element in my CSS based on some code I found on Stack Overflow, but it doesn't seem to be effective either.

CSS Code:

.NEON-header {
    background-color: #1ea0c1;
    height: 0;
    margin: 0 0 10em;
    padding: 0;
}

/* The following code was an attempt to clear the div but didn't work */
.NEON-header:before, .NEON-header:after {
    display: table;
    line-height: 0;
    content: ""
}
.NEON-header:after {
    clear: both;
}

.navigation-wrapper::before, .navigation-wrapper::after {
    content: "";
    display: table;
    line-height: 0;
}
.navigation-wrapper::after {
    clear:both;
}

.site-name {
    display: inline;
    float: left;
    font-size: 1.2rem;
    margin-left: 4.16667%;
    margin-right: 4.16667%;
    padding: 1em 0 0;
    width: 16.6667%;
}

.top-navigation {
    display: inline;
    float: left;
    margin-left: 0;
    margin-right: 0;
    padding: 1em 0 0;
    width: 75%;
}

If you have any suggestions or ideas on what else I could try to ensure the divs stack above and below each other correctly without the overlapping issue, I would greatly appreciate your input. Thank you, Leah

Answer №1

Your issue lies in the fact that your .NEON-header CSS class has a height of 0px, causing your image to expand beyond its intended size. Simply eliminate the height: 0; property from your .NEON-header class. See below for revised code:

.NEON-header {
  background-color: #1ea0c1;
  margin-bottom: 30px;
}

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 is the best way to transform this into an HTML readable code?

While browsing through a template, I came across this code and I'm unsure of how to get it functioning. I've tried removing the comments, but unfortunately it doesn't seem to be working as expected. li.dropdown.navbar-cart ...

How can I trigger the second animation for an object that is constantly moving within a specific range in the first animation?

I am looking to create a simulation of rising and falling sea levels. Currently, when I click the button, the level rises from its starting point to the top, but I am unsure how to achieve this effect in my code. Below is the code I have written so far, an ...

Customize the background color of a Material UI row with varying colors for each cell

I am facing an issue with a Material UI table in React 18 where each cell has a different background color, causing the hover style on the row to break. Despite trying various solutions, I have been unable to find a resolution. For reference, you can see ...

Tips for aligning the first element in an inline-block list item horizontally

I'm working on a list with horizontal scroll functionality to allow users to view content by scrolling. I have successfully implemented this, but I'm facing a couple of challenges that I need help with: I want the first item in the list to alwa ...

Utilize Selenium with Eclipse (Java) to validate the CSS table border style

I'm currently conducting a form test that involves leaving mandatory fields empty to verify if the field displays a red border indicating it needs to be filled before proceeding. Below is the code snippet I have implemented so far: driver=new Firefox ...

Leveraging CSS and JQuery to manage an iframe with a programmed autoplay feature embedded within

My presentation was created using Adobe Presenter and inserted via an iframe with autoplay enabled upon publication. This means that as soon as the page loads, the presentation begins automatically along with the audio. Since I am unable to disable autopl ...

The layout designed with CSS Grid features two static sidebars, but unfortunately, the main content is not aligning

After deciding to experiment with CSS-grid, I encountered a frustrating roadblock. My goal was to create two fixed navigation bars on the left and right sides, with the main content in the center that would be scrollable. <div class="grid"> < ...

How Bootstrap Navigation is negatively impacting the width of the website

I am experiencing a problem with site width changes in the navigation. I have checked margins and padding, but couldn't find a solution to fix the issue. It seems like the row element is causing the problem, but I'm not sure why. Please assist me ...

What is the impact of using overflow: hidden on block elements?

HTML <div class="top"><p>hello</p></div> <div class="bottom"><p>hello</p></div> CSS .bottom { overflow: hidden; } While delving into the world of CSS, I encountered an interesting qu ...

Challenges encountered while making CSS adjustments on the Wordpress Twentyfourteen theme

I'm currently assisting a friend with making some final adjustments to their website. The site is built on Wordpress using the Twentyfourteen theme and can be found at centromariposa.no. Most of the modifications have been completed, but I'm fac ...

What is the best way to contain several elements in a flexbox with a border that doesn't span the entire width of the page?

Just dipping my toes in the waters of web development and I've come across a challenge. I'm attempting to create a flexbox container for multiple elements with a border that doesn't stretch across the entire width of the page, but instead en ...

What could be causing the issues with the compatibility of <input type="text" and flex properties?

I'm having an issue where the search box expands in size when I apply display:flex in my CSS. Can someone explain why this happens and offer a solution to return the search box to its normal height? Additionally, I would like the search bar and the se ...

Sending data from an HTML table hyperlink to a SQL query on a subsequent page

I am in need of assistance with passing a value from a database. I have successfully achieved this using drop-down boxes, selecting the option and then posting it with a submit button to populate tables in Display.php. However, my current task involves an ...

Tips for adjusting the color of a row when hovering

Can I modify the row color on hover in material-table using props? Similar to this example. Appreciate your help. ...

Content that sticks to the footer

I've been utilizing the sticky footer solution found at: This is how the CSS appears: * { margin: 0; } html, body { height: 100%; } .wrapper { min-height: 100%; height: auto !important; height: 100%; margin: 0 auto -4em; } .footer, .push { height: 4 ...

Horizontal Scroll HTML

Currently in the process of building a website for my father, everything is going smoothly. I followed a helpful Stackoverflow tutorial to create a specific webpage that I now want to customize with a hyperlink and make it scroll horizontally: Sliding divs ...

How can you use jQuery to activate a specific tab?

I have 3 tabs with 3 different ids. $(document).ready(function() { $(function() { $( "#tabs" ).tabs(); }); $("#links > a").click(function() { var link = $(this).attr('href').substr(-1,1); console.log(link); $('#t ...

Having trouble with sending a POST request to a URL?

I'm attempting to communicate with an API by including the parameters in the URL. I am uncertain whether it will return XML or JSON, but it will be one of the two. Unfortunately, I keep encountering an error message. Here's an example of my requ ...

Distinguish between datalist selection and text input in BootstrapVue Autocomplete

When looking at the code snippet provided below, I'm trying to figure out the appropriate event/method to determine whether the value entered in the input field was manually typed or selected from the <datalist>. SAMPLE CODE: <div> &l ...

Having trouble with JQuery's .prop function not unchecking a checkbox?

I have been experimenting with different solutions in order to uncheck a checkbox when another checkbox is checked. Unfortunately, none of the methods I've tried seem to be working effectively... Currently, my code looks like this: $("#chkBox1").cli ...