Prevent the body from being redirected to the static menu

One issue I'm facing is that when I resize my page, the body content ends up in the fixed menu area.

I have been using a combination of pixels and percentages, but how can I prevent this from happening?

Check out this example on jsfiddle

<div class="menu">This is the menu</div>
<div class="body">This is the body content</div>

.menu{
    height: 100%;
    position: fixed;
    background-color: red;
    width: 200px;
    float: left;
}

.body{
    background-color: yellow;
    float: right;
    width: 60%;
}

Answer №1

You have the option to employ width: calc(100% - 200px); for the .body element.

For instance: Check out this jsFiddle link

Note: This method works only on modern browsers.

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 Fieldset Legend Mystery: Unraveling Internet Explorer's

I'm at my wit's end. Currently, I am customizing the front end of an ASP.NET built website, and one of the sections includes a fieldset with a legend. However, this specific area appears differently on IE, Firefox, and Chrome. Out of the three, ...

"Utilizing flex-box to create a hover effect for child elements

I am attempting to create a grid caret with a top and bottom caret that displays a grey area when the user hovers over each side. <div class="control-wrap"> <div class="caret-wrap"> <span class="caret">▲</span> </div&g ...

What could be causing html-webpack-inline-source-plugin to prevent the page from refreshing after editing CSS files?

Currently, I am utilizing a plugin that embeds all CSS within the final HTML file. This method prevents the application from refreshing in development mode. Whenever I make edits to the CSS, the build process completes normally, but the styles do not updat ...

CSS3 circular gradient effect

I am trying to figure out if it is feasible. The photoshop team created an image that originally had a gradient fading from 1 to 5 colors. Now, they have added a white circle on top of it. How can I achieve this effect? The provided examples lack specific ...

Center align the image without any additional spaces

https://i.sstatic.net/Oxmqa.pngI'm looking to center align the logo within the navigation bar on my page. Here is the code I currently have: <div class="nav"> <ul> <li id="center"> <a href="home.php">&l ...

What is the best way to toggle the display using Jquery?

I'm in the process of setting up a FAQ page where answers can be toggled for display. Here is the step-by-step guide on how to achieve it: $(document).ready(function () { $('.faqlink').click(function () { $('.hiddenFAQ&ap ...

What techniques can be used to resize an image to perfectly fit a square on a webpage?

A challenge on the web page is to display images in a square format of 90 * 90 pixels. However, the sizes of these images are not consistent and may vary from 80*100 to 100*80 or even 90 * 110. The requested solution is to stretch the image as follows: ...

Is there a way to extract the properties of a CSS class from a stylesheet and convert them into a hash using JavaScript or jQuery?

I am exploring a way to extract key value pairs from a CSS stylesheet related to a specific class or id into a JavaScript object for data accessibility. It is important to mention that I do not intend to apply this class directly to any DOM elements. In ...

Header with h1 formatting

I'm having trouble getting 'by Jackie' to align under the 'Bella' logo without adding excessive space. Does anyone have any suggestions on how to resolve this issue? HTML: <div class="header"> <div class="wrapper"> ...

positioning of multiple buttons in a customized header for mui-datatables

I'm currently using mui-datatables in my app and have customized the table toolbar to include additional buttons. However, I've encountered an issue where adding a second button causes it to be displayed below the first one, despite there being e ...

Unveil a portal to the identical webpage

My apologies for my English skills... Could anyone advise me on how to display an image? Hello, I am looking for a way to have a small window open on my site when a user clicks on the zoom icon, where I can describe a product. Any guidance on the HTML co ...

Encountering issues with custom.css.scss not being properly overridden in Rails while using Bootstrap

My Configuration I made modifications to the .col-lg-4 class in Bootstrap for Rails and added them to my custom.css.scss file after the import statements to remove padding completely. The Issue at Hand I am trying to override the styling of .embed-respo ...

Exiting the modal/popup box is currently disabled

I am struggling to figure out why the modal box/pop up is not closing when I click 'x'. It seems completely unresponsive. Check out the JavaScript code below: var kite = document.getElementById("poptext"); var kitetwo = document.getElementById( ...

The use of scaffolding and grid structures within the Twitter Bootstrap framework

I'm currently utilizing the bootstrap scaffolding/grid system in the following manner: <div class="row-fluid"> <div id="insta-shop-filter" class="span2 visible-desktop"> </div> <div id="insta-shop-grid" class="span1 ...

"Endowed with improper dimensions, the BootStrap collapse feature

Yesterday, I posted about an issue with BootStrap and panel collapsables causing graph sizes to become distorted. The post was locked because there was no accompanying code. I have now created a code snippet for you all to see the exact problem I am facing ...

Sequentially animate objects with a fade-out and fade-in effect

Attempting to achieve a fade-out, fade-in animation using JavaScript and CSS. Here is the CSS animation code: @keyframes fade-in{ 0%{ opacity: 0%; } 100%{ opacity: 100%; } } @keyframes fade-out{ 0%{ opacity: 100%; } 100%{ opacity: 0%; } } Impleme ...

Require help with personalizing a jQuery horizontal menu

I recently downloaded this amazing menu for my first website project By clicking the download source link, you can access the code Now, I need your kind help with two issues: Issue 1: The menu seems to be getting hidden under other elements on the page ...

I'm having trouble viewing my navigation bar, even though everything seems to be correct

I'm facing an issue where the navigation bar is not visible even though everything seems to be correct. I have checked and double-checked but still can't figure out what's wrong. It's becoming quite frustrating and I'm at a loss fo ...

Adding CSS styles to a pre-existing table structured like a tree

Can a CSS style be applied to a pre-existing HTML table structured as a tree? For instance, in Firefox, the Bookmarks Library table is set up as a tree. Is it feasible to add a CSS style to one specific column without affecting the others? While using tr ...

Utilize CSS to create a column layout

I have some HTML output that I would like to style using CSS, but unfortunately I have no control over how the HTML is generated and cannot make any changes to it. Right now, I have a two-column layout set up here: http://jsfiddle.net/uvg6f3tr/ I'm ...