By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,493 Members | 1,920 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,493 IT Pros & Developers. It's quick & easy.

div height

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.