473,809 Members | 2,826 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Two divs and the old 100% height problem

Hello,

Yes, I've spent hours reading through all the old postings and
searched
the net - but couldnt find a solution to the 100% height problem with
nested divs.

Basically I want the first box to be 250px high, and the one below it
to take up the rest of the browser window. I have a big div around the
lot (set to 100% height), and thought that the bottom div would fill
it up without stretching it - yet it stretches.

My code (For IE) is as follows:

<html>
<head>
<style type="text/css">

div.whole {
width:100%;
height: 100%;
border:3px solid green;
}

div.topbar {
height:250px;
width:100%;}

div.lower {
border:5px solid red;
height: 100%;
}

</style>
</head>
<body>

<div class="whole">

<div class="topbar"> Top bar for logo</div>
<div class="lower">M ain</div>

</div>

</body>
</html>
Thanks loads, Josh

Jan 27 '07 #1
1 4334
Fixed it myself, here's the code for anyone else with the same
problem:

<html>
<head>
<style type="text/css">

html body {
margin:250px 0 0 0;
padding: 0;
overflow:hidden ;
}

html #top {
position: absolute;
top: 0;
width:100%;
height: 250px;
border: 5px solid red;
}

html .content {
top:180px;
border: 5px solid green;
overflow:auto;
height:100%;
}
</style>
</head>

<body>
<div id="top">Header </div>
<div class="content" >Main content</div>

</body>
</html>
On Jan 27, 1:16 pm, joshthoma...@ya hoo.co.uk wrote:
Hello,

Yes, I've spent hours reading through all theoldpostings and
searched
the net - but couldnt find a solution to the 100%heightprobl em with
nested divs.

Basically I want the first box to be 250px high, and the one below it
to take up the rest of the browser window. I have a big div around the
lot (set to 100%height), and thought that the bottom div would fill
it up without stretching it - yet it stretches.

My code (For IE) is as follows:

<html>
<head>
<style type="text/css">

div.whole {
width:100%;heig ht: 100%;
border:3px solid green;

}div.topbar {height:250px;
width:100%;}

div.lower {
border:5px solid red;height: 100%;

}</style>
</head>
<body>

<div class="whole">

<div class="topbar"> Top bar for logo</div>
<div class="lower">M ain</div>

</div>

</body>
</html>

Thanks loads,Josh
Jan 27 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
3775
by: Garmt de Vries | last post by:
I would have guessed that this issue had been discussed to death, but I couldn't find an answer to my problem in the ciwas archives. So, at the risk of asking something trivial, here goes: I want to have a page that looks as follows: at the left, a blue column with a navigation menu. The rest of the page, with a white background, is for the content. The blue fades smoothly into the white. I managed to do this by using a background...
11
7888
by: Not4u | last post by:
Hello, I have a problem with CSS code. I want to have one menu column with a fixed width and a 100% height and the rest of the page for content. ---------------- |.|.|<--100%-->| |.M.|----------| |.E.|----------| |.N.|----------| |.U.|----------|
1
2466
by: UnderTaker | last post by:
Hi guys, I got a small problem which is driving me mad. I don't know if what I want to do is impossible or I am just overlooking something stupid, in both cases I hope you will answer me. I got a tableless 3 colums layout, container div is set to 100% height. First column (id="newsbox") too is 100% height and it as 2 div inside; first one(id="graphic"), is set with height on 350 pixel, second one (id="news") contains an iframe. The...
0
1695
by: Robert | last post by:
Hi, I am having some difficulty to have two DIVs or cells on top of eachother that take (at least) 100% of the browser height. First I tried to use DIVs and set them HTML and BODY height to 100%. http://www.xs4all.nl/~rvanloen/example/robert1.html Both IE6 and Firefox make the entire content too large. I expected the 100% of
3
12955
by: monkey64 | last post by:
Hello Well I'm a newbie to CSS and I have an issue with using 100% height when viewed in Firefox. If I use a pixel measurement, everything works well. I uploaded it to my site: http://www.realbabyguide.co.uk/test.html I'm trying to make an always centered DIV which I've called container. The website fits into this DIV. The yellow blocks are floated left. Any ideas? I'm tearing my hair out (what's left of it!). Maybe I should...
0
1809
by: JimmyHoffa | last post by:
Can anyone help me get I.E 6 to show an absolute positioned div with height as 100% to actually be 100% height of its containing div (which also has height set to 100%)? I.E 7 and Firefox both render the page as intended but I.E.6 causes issues. Is this a common problem ?
4
4336
by: Christopera | last post by:
Hello, I have built a site that uses two divs, one verticle, and one horizontal as graphic style for the ite. The problem I am having is that if the browser is resized very small the divs are then smaller than the website is wide. I have tried fixed positioning but then i get the dreaded overlap when the browser is smaller than the website. Absolute positioning gets rid of the overlap but then brings on the width issue. Is there a way to...
1
1705
by: beansetc | last post by:
Since I began doing CSS layouts instead of tables last year, it seems like every single site I do I run into the same problem -- getting a div to stretch to 100% height. I find the solution to it, it works; then when I try the exact same solution for the next site I do, it refuses to work properly. It's very frustrating how such a simple concept can be so hard to do... http://www.pinstripepresentations.com/stephanie/residential.php There...
1
1913
ilya Kraft
by: ilya Kraft | last post by:
Hello, I have this problem: have my div with wrapper id, want it to expand width, height 100%, but for some reason it is not expanding in height. it contains image that i want to use as a top background in this site http://idaderko.netai.net now it has blue background, wrapper div contains another image that goes on the top, but i need wrapper to be on 100& height here is css code for that div:
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10633
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10375
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3860
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.