Elements that can be adjusted in fixed (two) and fluid (one) arrangements

My goal is to design a layout with 3 elements, two of which have fixed width while the third will occupy the remaining width of the parent container.

(1): fixed-fluid-fixed The fluid element contains 2 divs, one floated left and the other floated right inside the middle fluid div.

(2): When the fixed divs are placed beside each other, the arrangement should be like this: fixed-fixed-fluid.

(3): If one of the fixed divs is removed, the fluid div should expand to fill the space, resulting in a fluid-fixed layout.

(4): Similarly, if the later fixed div is deleted, the fluid should grow to take up the space, creating a fixed-fluid layout as illustrated.

My Attempts: http://jsfiddle.net/nagendra_rao/28QUr/ (currently unable to rearrange the divs)

I prefer not to use JavaScript, I believe that achieving this layout is possible solely through HTML and CSS.

Answer №1

To create a layout with two or more <div> elements, follow these steps:

<div id="left_column_200px">
    <!-- insert content here -->
</div>
<div id="column_100%_of_remaining>
    <!-- insert content here -->
</div>

#left_column_200px {
    width: 200px; height: auto; overflow: hidden;
    position: absolute; top: 0; left; 0;
    z-index: 2;
}
#column_100%_of_remaining {
    width: auto; max-width: 100%; height: auto; overflow; hidden; padding-left: 200px;
    float: left;
    z-index: 1;
}

By implementing this code, you can achieve the desired layout.

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

Why do my tablet media queries take precedence over mobile view media queries?

I've noticed that when I view my website on mobile devices, the tablet media queries always seem to override my mobile media queries. Can anyone explain why this is happening? Here is how I have set it up: /* X-Small devices (portrait phones, less t ...

An interactive selection tool for a website's navigation bar

Struggling to implement a dropdown menu for my navbar, none of the CSS methods I've tried seem to work. My current HTML code is as follows... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-t ...

On a Samsung tablet with Moodle, the body background image is set to display at the top

Encountered an issue with Sambungs tables. I have a background image set on the body. Here is how the CSS looks: html, body{ background: url('img/background.jpg') no-repeat; background-position: top; // I also tried cover, fixed, etc } The ...

I am attempting to create a webpage with a primary center image and two additional images on either side using PHP or HTML

I have a coding dilemma - I want to display three images in a single row, one in the center, one on the left, and one on the right. However, my current PHP code is causing the left and right images to appear below the center image. How can I adjust my co ...

Display an image in a new window

Hey, I want to display an image in a separate window when it is clicked. Here is my HTML code snippet: <div data-role="content" class="jqm-content"> <h2>Photo popup example</h2> <div data-demo-html="true"> <a href="#popup ...

What is the best way to prevent a modal from being triggered specifically on mobile devices such as phones and

$(function() { $('.pop').on('click', function() { $('.imagepreview').attr('src', $(this).find('img').attr('src')); $('#imagemodal').modal('show'); }); }); .modal-ba ...

Asymmetrical Edges for a Pair of Divisions

Is there a way to skew two divs without a white line in between, similar to this example: Desired outcome I have tried using a negative top margin, but it doesn't work well in responsive design. Current result Here is the code I am using: ... < ...

During the initial cycle, the CSS keyframes animation may experience glitches, but it will run smoothly in subsequent cycles

Seeking advice on troubleshooting a CSS keyframes animation issue. I have created an animation with 5 frames where the background image fades and transitions to the next image smoothly in all cycles, except for the first cycle where it glitches before each ...

Ways to eliminate the blue outline on a checkbox in bootstrap 4.1

Bootstrap 4.1 Is there a way to get rid of the blue border on a checkbox that shows up when it is in focus? https://i.sstatic.net/e77BV.png I attempted to use outline, but it didn't work as I had hoped. This is the code I have been using: <div ...

Issues with Bootstrap loading correctly within a Ruby on Rails application

What steps should I take to successfully load Bootstrap 4 on my web app? Here is the contents of my Gemfile: gem 'rails', '~> 5.1.5' gem 'devise' gem 'bootstrap-sass', '~> 3.3.7' gem 'sass-rail ...

Refresh the interval variable displayed on the webpage in HTML

In the head section: let timeLeft = 45; function initiateCountdown() { timeLeft -= 1; } setInterval(initiateCountdown, 1000); In the body section of the page: document.write(timeLeft); function updateTimer() { document.replace(timeLeft) ...

What is the best way to connect my JavaScript to this HTML for seamless functionality?

Hello fellow coders! I am a newbie in the coding world and I am facing some challenges with getting my javascript to work on my website. The main purpose of the javascript is to create smooth transitions between different sections of the site. I would grea ...

Monitor and follow a specific row in a table on a web client page that does not have a unique identifier, while this table continuously fills with data in real

Currently, I am engaged in the development of a web client-GUI-automation testing tool using selenium with x-path and CSS. The web client features a panel area located at the bottom. Within this panel lies a table that lacks a unique identifier for its ro ...

Combining ThreeJs with AngularJs and OBJLoader results in no rendering or error messages being displayed

Looking to integrate my basic script that was previously working smoothly into AngularJs. Here is my controller and the basic HTML structure. Upon execution, no errors are shown, just a blank page with internal elements displaying information but not visib ...

How can I extract substrings bounded by certain patterns using regex for parsing HTML?

When working with well-organized strings in HTML format, I am extracting data. The structure typically looks like this (with added newline for readability): <span><h2>Category 1</h2> <p><strong><u>Entry 1</u></ ...

Clearing selections from a multiple-choice input field

I am seeking to implement a delete feature in a multi-select element similar to the functionality seen here on stackoverflow when selecting multiple tags for a question. Once an item is selected, I would like to display a close icon next to it so that user ...

Problem with connecting CSS to HTML in Django

I've looked at other posts regarding this issue, but so far none of the solutions have worked for me. I'm working on a django project and trying to apply some basic CSS to my page, but for some reason it's not linking properly. My HTML file ...

Steps for making a floating header with jquery.floathead

After discovering the jquery.floatThead plugin, I thought it would be perfect for floating the table header while scrolling. However, I'm having trouble getting this plugin to work properly. Below you can find my HTML and JavaScript code, as well as ...

Tips for linking two project routes in NodeJS and incorporating React (I am interested in invoking React within the NodeJS project)

I'm in the process of linking two projects, one using reactJS and the other NodeJS. Currently, NodeJS is running smoothly on localhost:3000. Next, I want to call a React application which redirects to port localhost:3001. How can I seamlessly connect ...

Is there a way to make my DIVS update their content dynamically like buttons do, without manually adding an onclick function in the HTML code?

I am currently customizing a WordPress theme that lacks the option for onclick events on div elements. However, I can assign classes and IDs to them. In my design, I have four spans in a row, and when each span is clicked, I intend for the corresponding p ...