1

I know that it has been asked tons of times, but I'm still not able to find a fix for this issue. Here is what I have this: JsFiddle

<!DOCTYPE html>
<html>
<body>

<div id="container" style="width:auto">

<div id="header" style="background-color:#FFA500;">
<h1 style="margin-bottom:0;">Main Title of Web Page</h1></div>

<div id="menu" style="background-color:#FFD700;height:100%;width:auto;float:left;">
<b>Menu</b><br>
HTML<br>
CSS<br>
JavaScript</div>

<div id="content" style="background-color:#EEEEEE;height:100%;width:auto;float:left;">
test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content test content </div>

<div id="footer" style="background-color:#FFA500;clear:both;text-align:center;">
Copyright © something</div>

</div>

</body>
</html>

The problem us that the content is going under the menu. I tried everything in order to fix it, but it seems imposible. I'm pretty sure that I'm missing something small.

EDIT: The content should be next to the menu and the menu shuld have 100% height

chility
  • 746
  • 1
  • 9
  • 22

3 Answers3

4

Instead of float:left on the content , replace it with overflow:auto

This triggers a block formatting context and causes the content to fill the remaining horizontal place. See this post.

Updated FIDDLE

Community
  • 1
  • 1
Danield
  • 121,619
  • 37
  • 226
  • 255
  • Ok, but I need the footer of the bottom of the page. I mean that if the content is empty the page should not be changing. Now the footer is going up and everything seems to be messy. :( I also tried `bottom:0;` without success – chility Jun 30 '13 at 09:59
0

add position:absolute; to id="menu" and height:auto

#menu{
background-color: #FFD700;
height: auto;
width: auto;
float: left;
position: absolute;
}

LINK

or if you want it next to menu than this LINK

where you remove float to id="content"

Pumpkinpro
  • 837
  • 4
  • 5
0

use a parent div to menu and content, give it style overflow:hidden

Then give some width to the menu say 20% and float:left And to content give float:right and width 80%

I have updated your jsfiddle link.. It showing proper result

Ichigo Kurosaki
  • 3,765
  • 8
  • 41
  • 56