CSS: Understanding the Height Declaration

After struggling through a lengthy session of trial and error with my CSS stylesheet, followed by an even lengthier web search that yielded no solutions, I have decided to turn to this platform in the hopes that someone can offer guidance.

The issue at hand: I am attempting to create a website with a fixed header, footer, and side navigation bar. When I set the height property of the entire HTML body to 100 percent (or 100vh) and then allocate 15 percent to the header, 5 percent to the footer, and 80 percent to the content section, the height of the content area becomes disproportionately large. Although I may not possess advanced knowledge of CSS, I believe it should work as intended.

Below is the code snippet:

 // CSS code block goes here... 
<!doctype html>
<html lang="de">

<head>
// Head section content goes here...
</head>

<body>
  // Body content goes here...
</body>

</html>

If anyone could kindly shed light on where the problem lies within this stylesheet, it would be greatly appreciated.

Answer №1

Your layout is experiencing issues because all elements are absolutely positioned. It would be more effective to utilize flexbox or a bootstrap grid for better responsiveness across different screen sizes. Simply adjusting padding and z-index to fix the scrollbar problem won't provide a long-term solution, as the layout will break on other devices with varying resolutions.

I recommend exploring http://getbootstrap.com/ for an easier integration into your current code structure.

If you're looking to enhance your CSS skills, consider taking this free flexbox course at

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 width property is not being passed down to the table

I'm experiencing difficulties with the scaling of my body content. When the page is initially opened, it scales to 100%. However, when I resize the screen to make it wider, the content gets bigger but when I try to make it smaller again, it remains a ...

Trouble displaying image due to issues with javascript, html, Angular, and the IMDb API integration

I have been working on displaying images from the IMDb API in my project. Everything works perfectly fine when I test it locally, but once I deploy the project to a server, the images do not load initially. Strangely, if I open the same image in a new tab ...

Avoiding clashes between CSS styles in web applications

As I work on developing a web application that can be embedded on external websites, one of the challenges I am facing involves constructing dialogues with their own unique stylesheets. This could potentially lead to conflicts if both my dialogue container ...

Translate CSS into JavaScript while maintaining selector understanding

I am interested in developing a tool that can read a .css file and generate a function that will accept an array of class names as input and output the corresponding styles for an element with those classes, represented as a JavaScript object. This tool wo ...

Is it possible to remove certain 'css-' class names that MUI automatically applies to its components? (Using Next JS and MUI)

After successfully migrating my create-react-app project to Next JS using the latest version (12.1.0) and following the migration guide at https://nextjs.org/docs/migrating/from-create-react-app, I encountered an unexpected issue. Despite still using MUI a ...

How to Spin an Image in the Canvas Using HTML5

I am having trouble rotating an image inside a canvas after researching similar questions on Stack Overflow. Here's what I've learned: It seems I cannot rotate a single object inside the canvas. I can only rotate the entire canvas itself. ...

Basic CSS element placement

Visit my website here. There is a black video box under the product image that I want to align to the left. I tried to adjust the CSS but couldn't find anything causing the issue. When I move the video box above the Facebook button and align it to t ...

Displaying a fully customizable loading background color that adapts to various screen sizes while an

I have an application where I fetch an image and its size from a JSON. My issue is that when the image is loading, there is a gap left behind that I would like to fill. The problem arises when I try to use a div with fixed width and height to fill this ga ...

If an incorrect feedback message is displayed, the input icon will be disabled

Here is the issue I am encountering: This is the code snippet causing the problem: <div class="col-12"> <div class="form-group has-icon-left"> <label class="form-label" for="first-name-icon&quo ...

Guide: Using jQueryUI's explode effect to animate an HTML element explosion

I'm having trouble getting the jQueryUI explode effect to work properly. I've tested it out on this jsfiddle, but the explosion effect doesn't seem to happen as expected - the element just disappears with no explosion animation. $('h1, ...

What methods does the W3C CSS Validator use to recognize a CSS3 document?

Help Needed! Can someone tell me how to specify a CSS3 file for validation by the W3C? In HTML5, we use <!DOCTYPE html>, but what should we use in a CSS file? Whenever I try to validate my CSS file containing CSS3 elements like @font-face and box- ...

Ensuring the footer stays at the bottom of the page using Tailwindcss and ReactJS

I've read numerous articles and posts about achieving this, but none of the methods seem to be effective for me. My goal is to have the footer stick to the bottom of the page when viewed on mobile devices. It displays correctly on larger screens, but ...

Unable to load circles on page refresh with amCharts Maps

I am experiencing an issue with the functionality of my amCharts maps. Whenever I refresh the page, the circles that are supposed to be displayed disappear. However, when I zoom in, the circles reappear. This problem has me puzzled, and I'm not sure ...

Create a stylish frame around the interior triangle shape

I have created a div containing a triangle shape as shown below: #inner-div { width:200px; height:200px; background-color:black; position:relative; border:2px solid red; } #triangle { border-right:15px solid transparent; border-left:15px s ...

Having difficulty with integrating MYSQL Array functionality

I am struggling to display a MySQL array in an HTML dropdown menu and facing some difficulties. Here's an example: https://i.sstatic.net/8txSF.png The output looks like that. It correctly retrieves the number of rows but fails to display the actual ...

Adjusting ThreeJS Canvas to Utilize Entire Space

Here is a simple example I created for demonstration: http://jsfiddle.net/8nbpehj3/37/ <html> <body> <div class='wrapper'> <div class='nav'> <div class='button'>Button</div ...

"Upon submission, the form will display results within the designated div container

After struggling for a few days and editing some codes, I finally managed to send my form data to process.php without reloading the page. I am using a bootstrap layout and want to avoid the page reload or redirection to process.php. The HTML form works pe ...

Bootstrap table showing message "loading in progress, please be patient"

I'm having an issue trying to load data from an API into a bootstrapTable but it seems to be stuck on "loading..". Can anyone help me figure out what's wrong with my code? Thank you in advance for your assistance! <table id="table" ...

The date-picker element cannot be selected by html2canvas

I'm encountering an issue with Html2canvas while trying to capture a screenshot of my page. Specifically, the date shown in the date-picker on the page is not appearing in the screenshot. Do you have any insights into why this might be happening and h ...

Empty space found at the bottom of the webpage

Looking for help to remove the extra white space at the bottom of my upcoming portfolio website: The issue I'm facing is that the footer appears either too long or too short on most monitors. On tiny windows, there's a scroll and on larger resol ...