HighDots Forums  

div height

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss div height in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Remi Villatel
 
Posts: n/a

Default div height - 10-18-2004 , 09:38 PM






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_ (AT) _tele2 (DOT) fr
==================

Reply With Quote
  #2  
Old   
Mark Tranchant
 
Posts: n/a

Default Re: div height - 10-19-2004 , 07:07 AM






Remi Villatel wrote:

Quote:
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/


Reply With Quote
  #3  
Old   
Spartanicus
 
Posts: n/a

Default Re: div height - 10-19-2004 , 07:11 AM



Marek Mänd <cador.soft (AT) mail (DOT) ee> wrote:

Quote:
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


Reply With Quote
  #4  
Old   
Alan J. Flavell
 
Posts: n/a

Default Re: div height - 10-19-2004 , 08:13 AM



On Tue, 19 Oct 2004, Marek Mänd wrote:

Quote:
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.



Reply With Quote
  #5  
Old   
Remi Villatel
 
Posts: n/a

Default Re: div height - 10-19-2004 , 09:26 PM



Marek Mänd wrote:

[---CUT---]
Quote:
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---]
Quote:
Yes. Dont exceed the deadline.
No deadline for this work. It's personal.

Quote:
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. ;-)

Quote:
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_ (AT) _tele2 (DOT) fr
==================


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.