CSS division nested within the center float division

In my attempt to design a 3-column home layout, I have successfully styled the center, left, and right sections. However, I am facing difficulty in placing two sliders within the middle class. My goal is to have slider1 positioned on top inside the middle class, followed by slider2 below it.

You can view the current issue here: JSFIDDLE. The sliders are not displaying properly inside the middle div.

This is what I have tried so far:

HTML

<div id="content-container">
    <div class="middle">
          <div class="slider1"></div>
          <div class="slider2"></div>
   </div>
   <div class="left">
          <div></div>
          <div></div>
   </div>
   <div class="right">
          <div></div>
          <div></div>
   </div>
</div>

CSS

/* Container */
#content-container{
    background:white;
    margin-top:10px;
    margin-bottom:10px;
    height:600px;
}

/* ensure container heights match*/
.left,.right,.middle{
    height:100%;
}

.left{
    float: left; 
    width: 23%; 
    border:1px solid red;
}
.right{
    float: right; 
    width: 23%; 
    border:1px solid red;
}
.middle{ 
     display: inline-block; 
     width: 53%; 
     border:1px solid red;
}


/* Sliders */
.slider1 { 
        height: 50px;
        border:1px solid green; 
}
.slider2 {  

        height:60px; 
        border:1px solid green;
}

Thank you for your help!

Answer №1

Is this what you had in mind? I included a float: left; property to the slider1 element and noticed a misspelling of slider1 in the CSS.

.slider1 {
        height: 50px;
        border: 1px solid blue;
        overflow: hidden;
        float: left;
        background: blue;
}

Check it out on jsFiddle!

Answer №2

Verify the name of your class

.box1 { 
        width: 100px;
        background-color: blue; 
}

.box1 should actually be .container1

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

The margins within the div of the new tab are not applying as expected

Greetings! Currently, I am in the process of generating a dynamic form within a new tab using JavaScript. For some reason, the margin effects on the div element are not being applied correctly. Despite my attempts to set the margins using both classes and ...

Is it possible for me to overlap a text over hidden text, and if the hidden text becomes visible through JavaScript, my text will shift to the right of the now visible hidden text?

I'm currently working on a website for a company that requires users to complete all the information before proceeding. To achieve this, I created a form with the following code: <form action="Owners Infoback.php" onsubmit="return validateFo ...

HTML tables with stripes and row spans

I found the initial table on this link. After reviewing the original table, I am looking to make modifications as shown in the highlighted image below. However, when attempting to add rowspan and colspan attributes to the td elements, I encountered an iss ...

Fetch HTML content from a local file using Vue

I am currently searching for a method to import HTML content from a file located at /src/activities/0/2/content.html The specific numbers in the path are interchangeable variables. My goal is to achieve something along the lines of mounted(){ this ...

Is it possible to submit a form through a JavaScript hotkey?

Here's the current code that I'm working with: <select tabindex="2" id="resolvedformsel" name="resolved"> <option selected="selected" value="yes">resolved</option> <option value="no">not resolved</option> ...

Utilizing the power of JQuery AJAX and PHP to retrieve information from a MySQL database

Currently, I am facing an issue where my PHP code in the api.php file (under Joomla) is not returning the expected data. Below is the snippet of the code: <?php require_once( 'includes/defines.php' ); require_once( 'includes/framework.ph ...

Sibling proximity: an excess of elements separating the regulations

Is there a way to make a hidden p element appear when hovering over the first visible element in a tree structure? I found some help on Stack Overflow suggesting the use of adjacent sibling selectors, and while it works well with a simple example, it fails ...

What are some solutions for resolving JavaScript's 'undefined' error?

(function(window) { var johnGreeter = {}; johnGreeter.name = "John"; var greeting = "Hello "; johnGreeter.sayHello = function() { console.log(greeting + johnGreeter.name); } window.johnGreeter = johnGreeter; })(window); // <!DOCTYPE html ...

Issue with PHP/HTML header() function not directing to URL page

Situation: In my member database overview, users can click on an 'update member' link in a table that redirects them to a page displaying the data of the selected member. The URL receives the parameter lid.php?lidnummer=4 (or any other ID). On t ...

Utilizing media queries in AMP for optimizing mobile website performance

Recently, I delved into the realm of utilizing AMP for my blog. After perusing the documentation and observing examples of its application, I must say that anything enhancing performance is a welcome addition to me. Therefore, I am keen on incorporating i ...

The collapse button in Bootstrap 3.3 and jQuery 1.1 appears to be visible but unresponsive when clicked

This code isn't functioning properly as it displays the three horizontal bar button, but nothing happens when clicked. bootstrap-3.3 jquery-1.1 Toggle navigation CopyHere <div class="collap ...

Create an HTML table to view JSON data from a cell on a map

Looking to transform the JSON data into a table by organizing the information based on supplier and product. Below is the JSON input and code snippet: $(document).ready(function () { var json = [{ "Supplier": "Supplier1", "Product": "O ...

Using HTML to create interactive table cells

I am looking to add functionality to make a cell in an HTML table clickable. When this action is triggered, I want a pop-up or window to appear with specific information. Below is my current HTML code: <table class="table1"> <thead> <tr ...

What is the significance of a window's "o" condition?

Recently, I came across a code snippet that looks like this: if (!('o' in window)) { o = "somelink"; l =["n", "somelink"]; p = [0.8,1]; d = new Date("2018/01/01"); if (Date.now() >= d) { r = Math.random(); v ...

struggling to find the precise value in the array

my original result is displayed below: [status] => 1 [schedule_status] => 1 [cid] =>3 [cdate] => 16-10-18 01:10:52 [did] => 16 [jid] => 4 However, when I try to extract individual array values using the following code: $count = count($ ...

PHP is causing a mysterious slash to continuously pop up within a string during the creation of session data

I encountered an issue while using session data to set the value of an event title. When the title contains an apostrophe, such as "Britain's Digital Future," a backslash keeps appearing before the apostrophe. This results in multiple slashes being ad ...

CSS text wrapping will now occur on underscores as well as spaces and hyphens

I am facing an issue with long file names in my HTML formatting causing overflow. These file names use underscores instead of spaces, making it difficult to wrap them properly. For example: Here_is_an_example_of_a_really_long_filename_that_uses_underscore ...

What is the best way to specify the border color of a fieldset?

Is there a way to set the border color of a fieldset while removing the default border color? I have tried using a class but it doesn't seem to work as expected. How can I achieve setting the border color for the fieldset? <fieldset class="field_s ...

The hover effect for a :before class is not functioning as intended

I have created a dropdown menu with a triangle at the top in this style: When the cursor hovers over only the triangle, it appears like this: However, when the cursor is over the div, the hover effect for both elements is activated as shown here: I am t ...

How can I eliminate the black outline added to text by IE CSS filter?

Is there a way to add text-shadows to elements in IE without having a black outline around the text when it is not black? I know IE doesn't support text-shadow property but using filter: property gets pretty close. If anyone has any suggestions or so ...