473,503 Members | 3,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

div height

Hi everybody,

I have two div's: The one on the right is the content of the page, the left
one is the menu with a different background. Both are enclosed in a
container div.

How can I make the menu have the same height as the content on the right?
(Content is higher than viewport.)

So far, all I got is that the menu's div stops just below the text of the menu.

div.mbody {
margin: 0;
padding: 0;
}

div.content {
float: right;
/* position: absolute; */
right: 0;
top: 0;
width: 75%;
background-color: #fff;
}

div.navpanel {
float: left;
/* position: absolute; */
left: 0;
top: 0;
width: 25%;
/* bottom: 0; --> No use. */
/* height: auto; --> No use. */
/* height: 100%; --> Worst result! */
background-color: #c0ffc0;
padding-top: 10px;
font-family: sans-serif;
font-size: 90%;
}

As you can see, I tried various attributes but without getting any closer
from the expected result. What did I miss in the W3C's official CSS2 doc?

Somebody suggested me to set the same background to both the container mbody
and the menu navpanel... But that's one of the hack I dropped while looking
for a better solution.

I'm thinking about using a table. At least, I know that it will work. ;-)

Any better idea?

--
==================
Remi Villatel
maxilys_@_tele2.fr
==================
Jul 21 '05 #1
5 6175
Remi Villatel wrote:
I have two div's: The one on the right is the content of the page, the left
one is the menu with a different background. Both are enclosed in a
container div.
How can I make the menu have the same height as the content on the
right? (Content is higher than viewport.) [] As you can see, I tried various attributes but without getting any closer
from the expected result. What did I miss in the W3C's official CSS2 doc?
that it isnt written for easy reading.
It is meant for browser makers. And even they dont read and follow it
precisely.
Somebody suggested me to set the same background to both the container
mbody and the menu navpanel... But that's one of the hack I dropped
while looking for a better solution. I'm thinking about using a table. At least, I know that it will work. ;-)
Absolutely. There is no other way to do0 it in html and css.
Besides in CSS you simply would do the same, but with css tables, in
which you turn DIVs to table rows and table cells. Just matter in
general of writing tagnames differently. Bus since iE doesnt support it,
take tables, do the work with them.

Any better idea?


Yes. Dont exceed the deadline.
Use tabes and everything will be looking nice as your customer wants it
to look. Use floats and css and you will hear your client moaning.
Do you want to spent twice as much as time remaking it after if client
doesnt like it just because he has the money to pay you for (but you
wanted to be cool and experiment with the "bleeding css evangelism")? No.
Thus take tables, collect your pay and both be happy.
Jul 21 '05 #2
Marek Mänd <ca********@mail.ee> wrote:
As you can see, I tried various attributes but without getting any closer
from the expected result. What did I miss in the W3C's official CSS2 doc?


that it isnt written for easy reading.
It is meant for browser makers.


http://www.w3.org/TR/CSS21/about.html#q2

--
Spartanicus
Jul 21 '05 #3
Remi Villatel wrote:
I have two div's: The one on the right is the content of the page, the left
one is the menu with a different background. Both are enclosed in a
container div.

How can I make the menu have the same height as the content on the
right? (Content is higher than viewport.)


Set the container background to the colour you want the menu background;
set the menu background to transparent (or don't specify it). Set the
content background as desired.

This will work so long as the content is longer than the menu.

--
Mark.
http://tranchant.plus.com/
Jul 21 '05 #4
On Tue, 19 Oct 2004, Marek Mänd wrote:
Use tabes and everything will be looking nice as your customer wants
it to look.


If I'm the "customer", then I'd want to see and hear it adapting
itself gracefully to any situation in which it finds itself. Tables
aren't, in general, very good at doing that. Which is no big surprise
to those of us who know what tables were originally meant for.

Jul 21 '05 #5
Marek Mänd wrote:

[---CUT---]
How can I make the menu have the same height as the content on the
right? (Content is higher than viewport.)
that it isnt written for easy reading.
It is meant for browser makers. And even they dont read and follow it
precisely.
That's my bedside book. ;-) Well, the only doc about CSS I ever use. I
suits my idea of a virtually complete doc... but I always open 4 different
browsers at the same time to see how they comply with. (Not to mention lynx
to also have a pure text rendering.)

[---CUT---] Yes. Dont exceed the deadline.
No deadline for this work. It's personal.
Use tabes and everything will be looking nice as your customer wants it
to look. Use floats and css and you will hear your client moaning.
My "client" i.e. myself only moan about CSS limitations and its stupidy
sometimes. ;-)
Do you want to spent twice as much as time remaking it after if client
doesnt like it just because he has the money to pay you for (but you
wanted to be cool and experiment with the "bleeding css evangelism")? No.
Thus take tables, collect your pay and both be happy.


What's wrong with being trendy? Besides CSS is here to stay --until the W3C
dumps the whole HTML as obsolete. So, better get used to it.

And I keep on using tables --enhanced with CSS-- when it suits my needs. I
have a loooooooooong habit of tables. My first reflex when I want to align
two things is *<table class=* and I convert to *<div class=* when I start
embedding tables into tables. Bad bad spaghetti code! ;-)

Any way, about my problem with the div height, I solved the problem with a
nice unicolor picture matching the solid color of the menu. Now I'm happy
that the menu refuses to extend to the bottom of the page. ;-)

See ya,

--
==================
Remi Villatel
maxilys_@_tele2.fr
==================
Jul 21 '05 #6

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

Similar topics

4
12169
by: Paul | last post by:
Hi, I'm wondering if someone out there can help me overcome this quandary. I need to be able to calculate the height of the current page. I need to calculate the height of the page in pixels after...
10
7826
by: John | last post by:
I have a table with two rows. On the first row is a text box and in the second row is an image. I have set the table cellpadding to 0 and cellspacing to 0. The table is leaving extra spaces in the...
12
6706
by: Stanimir Stamenkov | last post by:
Here are two cases regarding inline-level elements' line-height, padding and background, which I doesn't understand: <div style="background: black; color: white; line-height: 1.5">...
5
2895
by: Secret Guy | last post by:
Because of my experience posting various places over the last couple of weeks: I'm expecting to be greated with hostility for asking about concepts instead of "practical" things, since that has...
5
18587
by: Kevin Myers | last post by:
How can one obtain obtain the height of a MS Access 2K form? There is a width property, but I don't see a corresponding height property. I need to obtain the height of the form so that I can...
1
3356
by: polocar | last post by:
Ciao a tutti, leggendo qua e là per il forum ho scoperto che non sono l'unico ad avere questo problema. Se si inserisce un controllo ComboBox in un form di C#, non è possibile impostare la sua...
1
6472
by: Mike Collins | last post by:
I am trying to create some pages and have them take 100% of the window, but I cannot get 100% to work. If I set the height of my div, the page displays a scroll bar and it looks like I set the...
1
3345
by: mascouta | last post by:
I have a lot of problems with IE browser, one of them is described in this topic. in my website i have div Calculator with background image. it displayed perfectly with Firefox browser however in IE...
1
5144
by: pravinnweb | last post by:
can anyone tell me how to set auto height to outer div that is in green box id "gray-background" it should increase relatively to inner div "smbox" here is the css and html code it should work in...
4
2473
by: AAaron123 | last post by:
<body runat="server" id="MainBody"> <form id="form1" runat="server" style="background-color:green; width: 100%; height: 100%"> <br /> Table1" runat="server" Style="background-color:Yellow;...
0
7192
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,...
0
7064
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...
0
7261
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,...
0
7315
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...
0
7445
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4991
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...
0
3158
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...
1
721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
369
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.