insufficient coverage of wrapper around nested divs

http://jsfiddle.net/bobbyfrancisjoseph/2EfLz/1/

I recently created this code, but I am facing an issue where the wrapper div does not appear to contain the nested divs on the final page.

Answer №1

make sure to include the rule "overflow: hidden;" in your wrapper's style.

Answer №2

When your body elements, #left-container and #right-container, are floated, they are taken out of the regular content flow. To properly contain these floated elements, you will need to use a "clearfix." There are two ways to do this:

The first way is by using a clearfix, such as the one below. This is my preferred approach because it is inline and does not interfere with absolutely positioned elements that may overflow out of the container:


#wrapper:before, #wrapper:after {
    content:"";
    display:table;
}

#wrapper:after {
    clear:both;
}

#wrapper {
    *zoom:1; /* ie7 hasLayout fix */
}

The second way is by using overflow:hidden on your #wrapper container. I typically avoid this method because it may cut off positioned elements that overflow with position:absolute. Another option would be to add an element at the end of your container, but that is not the most ideal solution :).

You can see a demo using the first (and my preferred) approach here: http://jsfiddle.net/2EfLz/2/

Answer №3

Make sure to include overflow:hidden in your CSS for the #wrapper

#wrapper
{
    margin:0 auto;
    position:relative;
    background-color:#999;
    width:960px;
    border:dashed #006 thick;
    overflow:hidden;


}

Check out this demonstration on jsFiddle

Answer №4

To hide any overflow, add overflow:hidden; to the wrapper's style.

Answer №5

experiment with the following CSS code position: absolute;

            #container
           {
            margin:0 auto;
            position: absolute;
            background-color:#999;
            width:960px;
            border:dashed #006 thick;

         }

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

Is it possible to include pseudo element elements in the configuration of a custom theme in Material UI?

Within my file themeConfig.js, I have defined several theme variables that are utilized to style different components throughout my application. Among these variables, there is a need for implementing the -webkit scrollbar styles for certain components. Du ...

Top method for inverting the sequence of list elements

I've got this Skype history saved as HTML, with 20,000 list items < li > in reverse order. How can I swap them around so that the first item becomes the last and vice versa? Is there a PHP solution for this, or is there a simpler way using spec ...

Send a collection of list items from the client to a Spring MVC controller

Is it possible to send a dynamically changing list of values to a Spring controller in a submission? I came across a solution on this page, but it only seems to work with input fields since you can't assign a name attribute to the li tag. <ul id=" ...

The chosen options will automatically populate the text-boxes that require dynamic summation

I am encountering an issue with a select option that should dynamically populate specific values in text-boxes (different prices) based on the selected option. The goal is to sum up the values in the text-boxes and display the total in another text-box. Ho ...

Prevent iOS from scrolling both horizontally and vertically

I'm currently in the process of developing a web app and I want to prevent horizontal overflow (elastic band) type scrolling. Despite trying various solutions, such as: html, body {width: 100%; overflow-x: hidden;} Nothing seems to be effective... ...

Incorporating CSS into an HTML document with Jersey/Grizzly

This is the structure of my project: src/main/java -- main.java src/main/resources -- webapp -- -- css -- -- js -- -- images -- -- pages -- -- -- home.html Currently, my Maven project utilizes Jersey and Grizzly. I am able to call my REST services and lo ...

What are the best methods for capturing audio directly from a web browser?

One of my clients is looking to allow users to record a message directly from their browser and then save it as an audio file like WAV. What would be the most effective approach for achieving this - Flash, Java, or HTML5? The goal is to find a method that ...

Implementing Bootstrap Datepicker within the dynamically generated table rows

I am currently in the process of developing a data grid for a project and I am encountering an issue with implementing Bootstrap Datepicker on the Date field within the table. The problem arises when trying to use the datepicker on subsequent rows that are ...

Tips for utilizing @htmlattributes when configuring a datepicker:

Hello, I am attempting to change a simple input field into a date form. I have tried using the DateTime property with @Html.TextBoxFor(model => model.dateFin, new { type = "date" }) but it was not successful. As a result, I am resorting to using a simpl ...

Any ideas on how to add animation to this Raphael SVG Skillbar project?

I'm interested in using the Raphael Diagram Skillbar as shown in this link: HERE However, I would like to add animation to each line similar to what is shown here: (animation at start position) HERE Does anyone know how I can achieve that effect? ...

Running a function following the completion of an animation with setTimeout

Recently stumbled upon this cool code snippet on stack overflow http://codepen.io/anon/pen/LERrGG. I see a lot of potential in this pen, but the one drawback is the lack of functionality to execute a function after the timer expires. I've been trying ...

the php renderer fails to take into account the styles

Trying to convey this as clearly as possible. I have the variables below: $name = main channel and $childs = sub channels. When I remove the childs from the HTML, only the main channel shows up - which is expected. However, when attempting to style the su ...

background image alteration when scrolling

I've been attempting to change the background image on scroll, but I haven't had any luck finding a guide. So, I'm hoping someone here can help me out. I found a video that showcases exactly what I'm trying to accomplish - https://www.y ...

Combining ASP.NET MVC with HTML5 for dynamic web development

We are in the process of planning a new project and are interested in utilizing ASP.NET with the MVC pattern. Additionally, we want to incorporate the new features of HTML5. However, we have been having trouble finding sufficient information or connecting ...

Incorrect positioning on canvas

Is there a way to adjust text alignment within a canvas? Currently, my text is centered. However, when I change the text size, the alignment gets thrown off. Here is the code snippet: <canvas id="puzzle" width="480" height="480"></canvas> ...

Using data binding in VueJS to construct a dynamic URL

Exploring VueJS for the first time and it's been a great experience so far. However, I'm facing a couple of challenges with data binding. The requirement is for the customer to input an image URL, and no image should be displayed until a valid ...

Bootstrap 5: The alignment of NAV items to the right is off

Is there a way to align the navigation items to the right side? I'm currently using Bootstrap 5 and leveraging the navigation feature. By default, the items are positioned on the left, however, I wish to move them to the right side. I have tried util ...

Deciphering deeply nested arrays in AngularJS

Within my code, there exists a nested object that I am working with. My goal is to extract and display every node name within the list on an HTML table. $scope.data = { "name": "A", "children": [{ "name": "A1", "children": [{ " ...

Tips for incorporating automatic line breaks and setting a maximum column width in a table

Is there a way to set different maximum widths for table columns and enable automatic line breaks when entering text into the columns? Below is the code snippet I currently have: echo "<table border='1' cellpadding='10'>"; echo ...

Looking for assistance with extracting only numerical values from a webpage using Selenium in Python

Website Elements <td style="font-size:20px;font-family:LucidaGrande,tahoma,verdana,arial,sans-serif;padding:10px;background-color:#f2f2f2;border-left:1px solid #ccc;border-right:1px solid #ccc;border-top:1px solid #ccc;border-bottom:1px solid #ccc; ...