473,765 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help, bizarre Mozilla absolute position <div> problem

In the web site http://greywolfdesign.com , there is a pop-up menu (when
mouse over 'Portfolio' menu item), it always works well when using IE (6).

However, when using Mozilla 1.6, the popup works well for all the pages
except the 4 pages which can be opened by click the menu link in the
popup. In these four pages, the popup will always be shown at the
leftmost of its parent div (flow) instead of under the 'Portfolio' menu
item.

When tracing the javascript code, I found the the ....style.left and
....style.top cannot be set a value, and it causes the problem. However,
for all other pages, the values can be set.

36 function showPopup(id, menuid) {
37 clearTimeout(mT imeout[id]);
38 var loc = getElementPosit ion(menuid);
39 var popup = document.getEle mentById(id);
40 popup.style.pos ition = "absolute";
41 //
42 popup.style.top = loc.top + 15;
43 //
44 popup.style.lef t = loc.left;
45 //
46 popup.style.dis play = 'block';
47 }

That's the statements 42, 44 don't work in the problem four pages, but
they work for all other pages. The differents is the four pages may have
a few dreamweaver created javascript routines....

Or can it be a bug of Mozilla?
Jul 23 '05 #1
8 2053
nick wrote:
<snip>
42 popup.style.top = loc.top + 15;
43 //
44 popup.style.lef t = loc.left;
45 //
46 popup.style.dis play = 'block';
47 }

That's the statements 42, 44 don't work in the problem four
pages, but they work for all other pages. The differents is
the four pages may have a few dreamweaver created javascript
routines....

Or can it be a bug of Mozilla?


No, as usual it is a case of Mozilla doing what it is supposed to do and
IE being tolerant of errors. The properties of the - style - object are
assigned values that correspond with the values used in CSS, and all non
zero CSS length values (which include top and left) as specified to
require a type of unit; px, em, pt, %, etc. So non-zero length values
assigned without units are meaningless in CSS terms, and CSS requires
implementations to ignore properties and values that it does not
understand. Mozilla is ignoring the properties as it is supposed to.

The balance of probability is that the reason that Mozilla is not
ignoring the assignments all of the time is that the pages where you
have a problem are defined in such a way that the browser is put into
"standards" mode, where Mozilla is very strict about the interpretation
of CSS according to the published standards, and the pages that "work"
are such that the browser goes into "quirks" mode and re-produces some
of the erroneous behaviour exhibited by earlier versions and/or other
browsers.

There is a short description of handling the assigning of values for
positioning elements cross-browser, using CSS units where appropriate,
at:-

<URL: http://jibbering.com/faq/faq_notes/misc.html#mtCSSUn >

Richard.
Jul 23 '05 #2
Richard Cornford wrote:
nick wrote:
<snip>
42 popup.style.top = loc.top + 15;
43 //
44 popup.style.lef t = loc.left;
45 //
46 popup.style.dis play = 'block';
47 }

That's the statements 42, 44 don't work in the problem four
pages, but they work for all other pages. The differents is
the four pages may have a few dreamweaver created javascript
routines... .

Or can it be a bug of Mozilla?

No, as usual it is a case of Mozilla doing what it is supposed to do and
IE being tolerant of errors. The properties of the - style - object are
assigned values that correspond with the values used in CSS, and all non
zero CSS length values (which include top and left) as specified to
require a type of unit; px, em, pt, %, etc. So non-zero length values
assigned without units are meaningless in CSS terms, and CSS requires
implementations to ignore properties and values that it does not
understand. Mozilla is ignoring the properties as it is supposed to.

The balance of probability is that the reason that Mozilla is not
ignoring the assignments all of the time is that the pages where you
have a problem are defined in such a way that the browser is put into
"standards" mode, where Mozilla is very strict about the interpretation
of CSS according to the published standards, and the pages that "work"
are such that the browser goes into "quirks" mode and re-produces some
of the erroneous behaviour exhibited by earlier versions and/or other
browsers.

There is a short description of handling the assigning of values for
positioning elements cross-browser, using CSS units where appropriate,
at:-

<URL: http://jibbering.com/faq/faq_notes/misc.html#mtCSSUn >

Richard.

Thanks very much, also, i found difference cause the working and
non-working one is the DOCTYPE

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
This one will make javascript ignore (not assign) the value without unit.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
But this one will assume the unit is px and it works.

I found VS.Net also use the late one... and IE just works, is the late
one a better choice?
Jul 23 '05 #3
nick wrote:
Richard Cornford wrote:
nick wrote:
<snip>
42 popup.style.top = loc.top + 15;
43 //
44 popup.style.lef t = loc.left;
45 //
46 popup.style.dis play = 'block';
47 }

That's the statements 42, 44 don't work in the problem four
pages, but they work for all other pages. The differents is
the four pages may have a few dreamweaver created javascript
routines....

Or can it be a bug of Mozilla?


No, as usual it is a case of Mozilla doing what it is supposed to do and
IE being tolerant of errors. The properties of the - style - object are
assigned values that correspond with the values used in CSS, and all non
zero CSS length values (which include top and left) as specified to
require a type of unit; px, em, pt, %, etc. So non-zero length values
assigned without units are meaningless in CSS terms, and CSS requires
implementations to ignore properties and values that it does not
understand. Mozilla is ignoring the properties as it is supposed to.

The balance of probability is that the reason that Mozilla is not
ignoring the assignments all of the time is that the pages where you
have a problem are defined in such a way that the browser is put into
"standards" mode, where Mozilla is very strict about the interpretation
of CSS according to the published standards, and the pages that "work"
are such that the browser goes into "quirks" mode and re-produces some
of the erroneous behaviour exhibited by earlier versions and/or other
browsers.

There is a short description of handling the assigning of values for
positioning elements cross-browser, using CSS units where appropriate,
at:-

<URL: http://jibbering.com/faq/faq_notes/misc.html#mtCSSUn >

Richard.

Thanks very much, also, i found difference cause the working and
non-working one is the DOCTYPE

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
This one will make javascript ignore (not assign) the value without unit.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
But this one will assume the unit is px and it works.

I found VS.Net also use the late one... and IE just works, is the late
one a better choice?

Also I found that using the doctype <!DOCTYPE HTML PUBLIC "-//W3C//DTD
HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">, the
height: 100% doesn't work in Mozilla too. So I guess <!DOCTYPE HTML
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> should be better..
Jul 23 '05 #4
On Sat, 08 May 2004 01:02:04 -0400, nick <nb***@nospam.h otmail.com> wrote:
nick wrote:
[snip]
Thanks very much, also, i found difference cause the working and
non-working one is the DOCTYPE

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
This one will make javascript ignore (not assign) the value without
unit.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
But this one will assume the unit is px and it works.

I found VS.Net also use the late one... and IE just works, is the late
one a better choice?


In my opinion, you shouldn't use either. Transitional mark-up shouldn't be
used for modern pages. Move to Strict HTML and CSS (drop elements like
FONT and CENTER, and attributes like bgcolor and align).

Out of the two DTDs above, the former is better. Some browsers will not
actually interpret the DTD correctly and switch into "Standards mode"
without the URI.

As I said above, you should really use

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

and validate your pages (see <URL:http://validator.w3.or g/>).
Also I found that using the doctype <!DOCTYPE HTML PUBLIC "-//W3C//DTD
HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">, the
height: 100% doesn't work in Mozilla too.
What are you trying to set to 100% height? Have you considered the fact
that it shouldn't work according to the specifications?
So I guess <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"> should be better..


I'd say it means your code is still broken.

Mike

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 23 '05 #5
nick <nb***@nospam.h otmail.com> writes:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
This one will make javascript ignore (not assign) the value without unit.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
But this one will assume the unit is px and it works.

I found VS.Net also use the late one... and IE just works, is the late
one a better choice?


Not in my opinion. The first one triggers standards mode, the second
quirks/compatability mode. Quirks mode is made for compatability with
old, badly written pages, and it implements many of the flaws of IE
version 4. That means that old pages written for IE 4 will show as the
author intended. You should *not* make new, badly written pages. New
pages should be written according to the appropriate standards, and
should be displayed in standards mode. That will make them much more
forwards compatible than writing for a seven year old browser's
flaws and quirks.

In this case, add the "px" unit to your lenghts and be standards compliant:
popup.style.top = (loc.top + 15) + "px";
popup.style.lef t = loc.left + "px";

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #6
Michael Winter wrote:
On Sat, 08 May 2004 01:02:04 -0400, nick <nb***@nospam.h otmail.com> wrote:
nick wrote:

[snip]
Thanks very much, also, i found difference cause the working and
non-working one is the DOCTYPE

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
This one will make javascript ignore (not assign) the value without
unit.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
But this one will assume the unit is px and it works.

I found VS.Net also use the late one... and IE just works, is the
late one a better choice?

In my opinion, you shouldn't use either. Transitional mark-up shouldn't
be used for modern pages. Move to Strict HTML and CSS (drop elements
like FONT and CENTER, and attributes like bgcolor and align).

Out of the two DTDs above, the former is better. Some browsers will not
actually interpret the DTD correctly and switch into "Standards mode"
without the URI.

As I said above, you should really use

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

and validate your pages (see <URL:http://validator.w3.or g/>).
Also I found that using the doctype <!DOCTYPE HTML PUBLIC "-//W3C//DTD
HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">,
the height: 100% doesn't work in Mozilla too.

What are you trying to set to 100% height? Have you considered the fact
that it shouldn't work according to the specifications?

I want to create a white box in the grey background, and the white box
will be 100% of the browser window (there will be a little bit margin)
when resize. Is it a bad requirement?
So I guess <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"> should be better..

I'd say it means your code is still broken.

Mike

Jul 23 '05 #7
nick <nb***@nospam.h otmail.com> writes:
I want to create a white box in the grey background, and the white box
will be 100% of the browser window (there will be a little bit margin)
when resize. Is it a bad requirement?


The web is not paper. Why do you wan't to stop the document at the bottom
of the viewport, and not allow it to overflow? What happens if the content
can't fit in the space available?

Anyway, it's doable. You just have to avoid the collapsing of margins:
---
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css">
body,html {
height:100%; padding-top:0px;
padding-bottom:0px;
}
html {
margin-top: -1px;
margin-bottom: -1px;
}
body {
border-top: 1px solid black;
border-bottom: 1px solid black;
margin-top:0px;
margin-bottom:0px
}

.bottom { position:absolu te; bottom:0px; }

</style>
</head>
<body>
<div class="bottom" style="border:4 px solid green; background:#c0f fc0;
left:0px; right:0px; text-align:center;">
Hello World
</div>
<h1>Test</h1>
</body>
</html>
---

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #8
Lasse Reichstein Nielsen wrote:
nick <nb***@nospam.h otmail.com> writes:

I want to create a white box in the grey background, and the white box
will be 100% of the browser window (there will be a little bit margin)
when resize. Is it a bad requirement?

The web is not paper. Why do you wan't to stop the document at the bottom
of the viewport, and not allow it to overflow? What happens if the content
can't fit in the space available?

Anyway, it's doable. You just have to avoid the collapsing of margins:
---
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css">
body,html {
height:100%; padding-top:0px;
padding-bottom:0px;
}
html {
margin-top: -1px;
margin-bottom: -1px;
}
body {
border-top: 1px solid black;
border-bottom: 1px solid black;
margin-top:0px;
margin-bottom:0px
}

.bottom { position:absolu te; bottom:0px; }

</style>
</head>
<body>
<div class="bottom" style="border:4 px solid green; background:#c0f fc0;
left:0px; right:0px; text-align:center;">
Hello World
</div>
<h1>Test</h1>
</body>
</html>
---

/L

Thanks, in fact, i want a <div> with a minimum 100% height and it can
grow. I want to this because the content of each page is different and
I want to make it a uniform min 100% height (minimum).
Jul 23 '05 #9

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

Similar topics

2
3556
by: Ethan | last post by:
I'm trying to set up a page with a header and 2 columns. I would like to use <div>s rather than tables. The page is here... http://64.142.13.246/style_testing_site/style_model2.htm In both IE 6 and Mozilla 1.3.1 on Windows the two columns overlap a little with the right column in front. I'd like them to touching but not overlapping. #leftColumn has a width of 35% and #rightColumn has left 35% and width 65% so they should just fill the...
1
2891
by: nick | last post by:
In the web site http://greywolfdesign.com , there is a pop-up menu (when mouse over 'Portfolio' menu item), it always works well when using IE (6). However, when using Mozilla 1.6, the popup works well for all the pages except the 4 pages which can be opened by click the menu link in the popup. In these four pages, the popup will always be shown at the leftmost of its parent div (flow) instead of under the 'Portfolio' menu item. When...
8
5157
by: slim | last post by:
hi again all, i am still working on the website as mentioned in earlier threads and have hit another snag... http://awash.demon.co.uk/index.php http://awash.demon.co.uk/vd.css the php is pulling a name and placing it under the thumbnail (the text is
3
5012
by: Philip | last post by:
I am trying to make a bunched of left-floated divs that will be contained in a larger div. the floated divs all contain a left-floated img and text of varying sizes. If I don't set a height (or height:auto) the larger div doesn't seem to see the nested divs, and they spill out the bottom. IE seems to automatically resize the larger div as long as I set the height to 100% or any pixel size. Mozilla doesn't recognize the percent, and...
6
2673
by: Gustaf Liljegren | last post by:
Here's what I'm trying to achieve: 1. A <div>, centered on screen, 600px wide and 100px high, with a background-image (also 600 x 100). 2. Text (an <h1> element) positioned with precision inside the <div>, on the image. 3. A similar result in IE and FF... Here's some of the XHTML:
7
4229
by: Dario de Judicibus | last post by:
System: Windows XP SP1 + all latest patches (no SP2) Browser: IE 6.0.2800.1106.xpsp2.040919-1003 Problem: browser does not show, or partially shows, borders and background color of <DIV> as defined in CSS file. Forzing a drawing refresh by minimizing and restoring browser window or by overlapping another window on browser causes
4
7236
by: Tim Sheets | last post by:
Hi all, I am having a problem that seems so simple, I am almost embarrassed to ask about it. I am working on a page that has the layout largely css driven. The top of the page has two <img> tags, one a logo, the other a graphic just for looks. If I use the following code: <div id="header">
1
1814
by: drowned | last post by:
I am using div#container and then some more <div>'s inside it. How do I make Mozilla recognize that the container should wrap up everything. I have a div#mainContent, which is right floating inside the div#container and has content that goes below the container. Mozilla doesn't recognize that :( so the content is just floating around unwrapped when you scroll to the bottom of the page. Here is my two <div> elements: #container { ...
8
10047
prino
by: prino | last post by:
Hi all, I've written code (in REXX) that takes files in legacy languages (PL/I, COBOL, z/OS assembler, etc) and converts them into HTML in a format similar to what's displayed in the z/OS ISPF editor. A fellow member of the PCG has helped me by creating a bit of Javascript to emulate the scrolling and using Google I've now gotten it into a state where it almost passes the W3C Markup Validation Service. However, the one error, Error Line 166,...
0
9568
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
9398
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
10156
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
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
9951
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
8831
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
5275
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5419
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3531
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.