What could be causing my div to be pushed below another element when I apply a negative margin?

I am having an issue with the placement of a div (.section-page-layout). The margin is set to (margin-top:-200px), causing the div to go under another div (.section-page-header) when it should actually be going over it. I have uploaded the code to a demo link for you to view using Firebug or any other debugging tool. Feel free to take a look at the code I have included below.

Thank you in advance for your help!

CSS CODE

/* Header */
.section-page-header {
    background: url("../img/frontcover.jpg") no-repeat;
    background-size: cover;
    width: auto;
    height: auto;
    min-height: 727px;
    min-width: 1280px;
}
.section-page-header-title_container {
    width: 1280px;
    position: relative;
    margin: 0 auto;
}
......
......

HTML CODE

<!-- ===============
=== Section Page Template
=============== -->
<header class="section-page-header">
    <div class="section-page-header-title_container">
        <div class="section-page-header-title">

            .....

        </div>
    </div>
</header>
<section class="section-page-layout-container">
    <div class="section-page-layout">
        ....

    </div>
    .....

Answer №1

When a parent element has the CSS property overflow:hidden, any child elements that are moved outside of the parent will be hidden from view.

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

Displaying JSON data with dynamic color changes in an HTML table: A comprehensive guide

Scenario: I am currently working on a project where I need to fetch data from an external json file, parse it, and then dynamically add it to an HTML table using the footable jQuery plugin. Question: I have a query regarding how to use JavaScript to parse ...

How can I insert horizontal lines within the text of HTML content using a single TextView on an Android device?

There is some HTML content that includes nested unordered and ordered lists along with mixed lists. <html> // HTML content containing nested lists </html> I am attempting to display this HTML content on a single TextView using the following c ...

Lineup of pictures aligning with the consistent left margin of surrounding content

I am looking to create a row of images that aligns with the same margin-left as other content on my webpage, similar to the title in the example image provided. This row of images should scroll horizontally and extend all the way to the edges of the page. ...

Ways to retrieve all elements following a chosen element

Is there a way to include the last element too? $('div.current').nextUntil("div:last").css("color", "blue"); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <div>First</div> < ...

The server is currently pointing towards my local C drive directory instead of the desired message location

My goal is to create a functionality where, upon clicking the calculate button (without performing any calculations yet), the user will be redirected to a new screen displaying a response message that says "Thanks for posting that!". However, instead of th ...

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 the className attribute on the contents received from dangerouslySetInnerHTML

What is the best way to define the className attribute for a div that contains 'hello world'? <div dangerouslySetInnerHTML={{__html: '<div>hello world</div>'}} /> One option is to set it on the outer div like this: &l ...

"Windows Phone Users Experiencing Issue with Website Scroll Functionality

My latest project involved creating a responsive website with nodejs integration, and it performs well on various devices. However, a problem arises when viewing the website on the Windows Phone IE browser - the webpage refuses to scroll down. The cause o ...

What is the best approach for implementing a CSS reset across multiple websites with different content?

As I work on a page that will be displayed across numerous websites beyond my control, shown within a jQuery UI dialog window using $.load(), the content is vulnerable to the CSS directives set by each individual site. To prevent conflicts, I have made sur ...

Instructions on utilizing the transpiled "main.js" file using gulp

As a novice in Angularjs 1.0, I encountered issues with my script and decided to use gulp to compile ec6 to ec5 by implementing the code provided below. The compilation process generated the file main.js. However, I am unsure about how to connect it when l ...

Is there a way to catch a downloaded file inside an iframe?

My dilemma involves an external site embedded in an iframe that contains a save button to download a json file. I am seeking a solution to capture the contents of this downloaded file within my own code. Is there a possible method for achieving this? Rese ...

Images placed side by side, creating a dynamic and visually appealing layout

Can anyone help me figure out how to display three photos like this? https://i.sstatic.net/wD5At.png The photos cover the full width only if I set the css width: 100vh for all, but then the middle photo becomes disproportionate (black frames show how I wo ...

How exactly did Google Fiber design their onboarding guide?

Are you using HTML5 canvas animation or Flash for this website? It's a bit difficult for me to discern. Thank you! ...

Utilizing Bootstrap to arrange table cells in a shifted manner

I'm new to utilizing bootstrap in web development. I've been exploring various examples of bootstrap templates that include tables, and I noticed that when I resize my browser window, the table adjusts accordingly. Now, I'm curious to know ...

Utilizing JSON and select for dependency management

Let's say we have a JSON object: { "A": { "1": "1", "2": "2", "3": "3" }, "B": { "4": "4", "5": "5", "6": "6" }, "C": { "7": "7", "8": "8" } } And we also have ...

Contrast in spacing: comparing display block versus inline-block

Today, I stumbled upon something quite intriguing that has left me puzzled. Consider the following HTML: <div class="a"><div class="b"></div></div> And CSS: .a { background: blue; } .b { display:inline-block; height ...

What impact do negative positioning have on CSS elements in terms of responsibility?

Just diving into CSS and I have a question to pose: Is it considered good practice to utilize negative positioning in CSS? Are there potential compatibility issues with browsers like IE7 and IE8? What is your suggestion? #example-bottom { position: relat ...

Begin the animation again by hitting the start button, using the burst-engine and canvas

I have successfully created a simple animation using Burst Engine and HTML5. My goal is to make the start button trigger the animation to restart if pressed twice. Currently, when I press it, the animation just starts and nothing else happens. I suspect t ...

Prevent CSS from affecting child tables

Here is my CSS and HTML setup: .comTable { width: 95%; cellpadding: 2px; margin: auto; border-collapse: collapse; } .comTable td { text-align: left; } .comTable td:first-child { text-align: right; wi ...

Guide to ensuring the navbar remains at the top of the webpage following an image

I am attempting to create a sticky navbar that stays at the top of the page once the header has been scrolled past. It should have a similar effect as shown in this example on codepen.io, but with the addition of an image that stretches across most of the ...