473,386 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

percentage height divs in Mozilla

Vic
I've managed to achieve the effect I wanted in IE6 - although I had to
use an experession to set the vertical height of a div (I want it to
have an overflow and scroll) but I can't work out a way to duplicate
the effect in Mozilla/Firefox

the code is here:
http://www.fogcat.co.uk/example/example.html

Can anyone point me in the right direction - or at least tell me if it
is or isn't possible to get the same functionality in Firefox

(I don't have access to Opera, Konquerer and Safari at the moment so
I'm not even starting to worry about them.)
Jul 20 '05 #1
8 7390
Vic wrote:

set the vertical height of a div (I want it to
have an overflow and scroll) but I can't work out a way to duplicate
the effect in Mozilla/Firefox

http://www.fogcat.co.uk/example/example.html


FWIW, as a user, I find these scrolling divs to be a big pain in the
arse, especially with keyboard navigation. I hear mousewheels don't play
nice with them, either.

What do you find so terrible about normal scrolling that would make you
want to use one of these ishy things? Just curious.

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
Jul 20 '05 #2
If ALL else fails and you simply must have a segment that scrolls like that,
you can always use frames (ick).

Jeff
Jul 20 '05 #3
Vic wrote:
I've managed to achieve the effect I wanted in IE6 - although I had to
use an experession to set the vertical height of a div (I want it to
have an overflow and scroll) but I can't work out a way to duplicate
the effect in Mozilla/Firefox

the code is here:
http://www.fogcat.co.uk/example/example.html

Can anyone point me in the right direction - or at least tell me if it
is or isn't possible to get the same functionality in Firefox

(I don't have access to Opera, Konquerer and Safari at the moment so
I'm not even starting to worry about them.)


Imteresting that you use the Strict DTD and yet use MS Proprietory code
for height which only IE recognizes (do you see the conflict there?).
Use the proper height declaration as per:
http://www.w3.org/TR/CSS21/visudet.html#propdef-height
which every browser, including IE, recognizes. Then you will have a
vertical scrollbar for all.

--
Gus

Jul 20 '05 #4
Vic
Gus Richter <gu********@netscape.net> wrote
Imteresting that you use the Strict DTD and yet use MS Proprietory code
for height which only IE recognizes (do you see the conflict there?).
Use the proper height declaration as per:
http://www.w3.org/TR/CSS21/visudet.html#propdef-height
which every browser, including IE, recognizes. Then you will have a
vertical scrollbar for all.


Yes I know I'm using proprietory MS stuff - I started off trying to be
strict about the standards but the only way I could get the result I
wanted was to use the MS expression. I was hoping someone could point
me to a proper standard way of doing it.

The problem is, I believe, that I need a fixed (pixel) space above my
scrolling div for the logo, menu etc, but then I want the scrolling
area to expand to fill the rest of the window: therefore the height of
my scrolling div needs to be something like 100% - 170px.

If I use a fixed height like 400px things "work" but the vertical
height of the scrolling div doesn't change when the window is resized.
http://www.fogcat.co.uk/example/example2.html

If I use a percentage height (say 50%) it's closer - but again the
size of the scrolling div doesn't match the window size properly.
http://www.fogcat.co.uk/example/example3.html

I could do this if my scrolling div was related to the window by
percentage values all round but because i want a fixed size logo at
the top I'm getting difficulties.
Jul 20 '05 #5
Vic
I had a bit of a re-think and tried something slightly different, all
standard I think:
http://www.fogcat.co.uk/example/example5.html

With some interesting results, when you display the page in IE6 it's
not correct on initial display, but if you resize the IE window even
slightly it corrects its self and displays how I was hoping it would.
Very odd... but it is IE.

In Firefox it degrades fairly safely - but it still doesn't display a
scroll bar for the content div. It seems as though in Firefox it's
allowing the containing div (bottomHalf) for be auto expanded even
though I set its height to 100%.
Jul 20 '05 #6
Vic wrote:
I had a bit of a re-think and tried something slightly different


I played around with your problem and came up with this.
I hope that it will help.

--
Gus
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
body {background-color: white; margin: 0; padding: 0; height: 100%; }
#menuBar { position: absolute; top: 100px; background-color: Black;
color:white; width: 100%; height: 50px; }
#logo {position: relative; top:0; left: 10%; width: 80%; border: 1px
solid red; height: 160px; }
#bit2Wrapper { position: absolute; top: 0; left: 10%; width: 80%;
height: 100%; }
#bit2 {position: relative; top:0; left: 10%; width: 80%;
background-color: silver; overflow: auto; height: 200px; top:50%;
margin-top: -20px; }
</style>
</head>
<body>
<div id="logo">
LOGO<br>
This is the latest - trying to center the scrollable box in the
available space and then also when resized.
</div>
<div id="menuBar">
The Menu Bar
</div>

<div id="bit2Wrapper">
<div id="bit2">
<p>Exercise: to center the scrollable box within the available space
below Logo and Menu Bar and maintain this centering on page resizing (as
I understand the problem).<br>
One thing I don't understand is why you wish the Menu Bar to overlap the
Logo (dimension error? Red border applied).</p>
<p>Although it may be possible, to center a percentage valued box, I'm
unable to achieve it,
so I'm presenting a method where the scrollable box is of a fixed height
value and hopefully it will be either useful as is, or help to achieve
it by using a percentage height value.</p>
<p>All items are clear by looking at the code. The only item which may
require explanation is the method I used to achieve the vertical
centering.</p>
<p>The way I did it, is to position the top edge of the scrollable DIV
down with top:50% and then applied the following formula to get the
value for margin-top:</p>
<pre>
(Logo Height/2) - (Scrollable DIV Height/2)
</pre>
<p>A caveat to this is that overlapping will occur if screen size is
sufficiently decreased.<br>
--<br>
Gus</p>
</div>
</div>

</body>
</html>
Jul 20 '05 #7
Vic
Thank's for all your help there, much appreciated. I have now got
something that seems to work - it involves using some very thick top
and bottom borders to position the scrolling area.

I "borrowed" the idea from:
http://www.stunicholls.myby.co.uk/layouts/bodyfix.html

My implementation is at
http://www.fogcat.co.uk/example/ex10.html
Jul 20 '05 #8
Vic wrote:
Thank's for all your help there, much appreciated. I have now got
something that seems to work - it involves using some very thick top
and bottom borders to position the scrolling area.

I "borrowed" the idea from:
http://www.stunicholls.myby.co.uk/layouts/bodyfix.html

My implementation is at
http://www.fogcat.co.uk/example/ex10.html


I'm glad you have found another method, but you do realize that sadly
this one won't work with IE 5.5, whereas the method I presented does?

--
Gus
Jul 20 '05 #9

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

Similar topics

1
by: Put 030516 in email subj to get thru | last post by:
I've always been bothered about having to statically declare the size of a Java applet window (container?) in the calling HTML. I've always wanted the moral equivalent of width=50% statement (of...
0
by: null Effects | last post by:
I made a page that has some divs that I would like to line up next to each other. I used percentage values to set their positions and sizes, but in IE6 there are breaks in between them and I can't...
0
by: geod | last post by:
Folks, I'm relatively new to design all-css sites and have hit upon a snag. I'm sure it's something simple, but I haven't wrapped my mind around i yet. Here's the thing: My css file...
2
by: tomasio | last post by:
dear group, as nobody answered my recent posts (maybe they were too complicated) i just ask you to help me on a rather simple issue: how can i stretch divs to the full height of the viewport (in...
6
by: veerleverbr | last post by:
Hi, I have the following html: <div id="content"> <div id="leftpart">...</div> <div id="rightpart">...</div> </div> leftpart en rightpart are in the css set to float left. The content of...
22
by: Les Juby | last post by:
I am trying to adjust the window/table size of a website (www.worklaw.co.za) which has made use of DIV tags with its settings embedded in an CSS file. The client wants its width and height to...
6
by: Hacking Bear | last post by:
Hi, I still don't quite fully understand how to handle mixing border/margin pixel width with percentage width. In the example below, I want to place side-by-side two DIV boxes inside a box....
4
by: hans.kindberg | last post by:
This is how my page looks like in IE6: http://www.freewebs.com/hasodaki/default.txt (without advertising banner, browsable with IE6 and to see the code with the other browsers)...
2
by: damezumari | last post by:
I have three div blocks defined like this: #left1 { float: left; background-color: white; width: 184px; margin-right: 4px; text-align: left; }
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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
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...

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.