473,657 Members | 2,490 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 6188
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********@mai l.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
12189
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 all images and text have been displayed. This is the area that the visitor can 'scroll' up and down in. I have already calculated the height of the useable part of the browser using: document.body.clientHeight
10
7842
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 rows on the top and bottom of the picture and image. I need to make the height of the rows to be the same as the textbox and image. How do I do this? I have tried even setting the height of the table and all the <td> and <tr> tags to 1 but have...
12
6725
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"> <span>Abc</span> <span style="background: white; color: black; line-height: 3">Abc</span> <span>Abc</span> </div>
5
2908
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 been my experience for years and decades. Maybe I'm projecting hostility. I don't know. How can I ask about theory and concepts without offending people? I'll just continue asking and cross my fingers: According to the 2.1 spec, regarding...
5
18640
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 dynamically resize an object on the form in the form's Form_Resize method when a user resizes the form, both horizontally and vertically. Thanks, s/KAM
1
3369
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 altezza ad un valore diverso da 21. Forse, cambiando la dimensione del font, si potrebbe riuscire a cambiare anche l'impostazione dell'altezza... (MS farebbe comunque meglio ad introdurre per il ComboBox una proprietà AutoSize impostabile a "false"...
1
6479
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 height to about 150%. I tried using CSS, now I am trying tables. Can someone show me where I am mixing things up? Thanks. --Master Sheet <%@ Master Language="C#" AutoEventWireup="true" CodeFile="master.master.cs" Inherits="pts" %>
1
3361
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 browser the height of the layer increased and it shown longer than the regular height which makes troubles with the footer of the website. This is the CSS of the layer: .demo {position:absolute ; top:710px; left:380px; z-index:99; ...
1
5159
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 FF, IE6 and IE7 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> Employee Listing </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords"...
4
2482
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; width: 100%; height: 90%" BorderColor="Maroon"
0
8392
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
8305
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
8726
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
8503
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,...
0
8603
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7320
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1944
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.