473,398 Members | 2,368 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,398 software developers and data experts.

Setting <div> margin for NN4

This really is a JavaScript question. I have a site that looks fine in
everything but NN4. I'm afraid I don't have a URL, because the site is
very much unfinished.

The site is a header (which is a table) and a main <div> underneath
that. The main <div> is set to have a top margin of 3%, which works
fine, except in NN4. There, it looks like it has a margin of 20%, or
even larger.

I couldn't fix it with the @import hack, so I thought I might try
JavaScript. I tried something like this:

<script language="JavaScript" type="text/javascript">
if (document.layers) frank.styles.margin-top = "-20%"
</script>

(I called the <div> "frank" ...)

I'm very sorry, because I'm almost certain this isn't real JavaScript.
I'm just shooting in the dark. Is this *going* in the right direction,
or is this approach completely flawed? Would NN4 even understand
something like this?

TIA

Ian
--
http://www.aspipes.org/
http://www.bookstacks.org/
Jul 20 '05 #1
4 5024
Ian Rastall wrote:

The site is a header (which is a table) and a main <div> underneath
that. The main <div> is set to have a top margin of 3%, which works
fine, except in NN4. There, it looks like it has a margin of 20%, or
even larger.

I couldn't fix it with the @import hack, so I thought I might try
JavaScript. I tried something like this:

<script language="JavaScript" type="text/javascript">
if (document.layers) frank.styles.margin-top = "-20%" AFAIK you can only access a DIV element through javascript in NS4 if it
is positioned. If it *is* positioned, then
if(document.layers)
document.layers['frank'].style.marginTop=....;
might get you access to the style object property of the layer and set
its top margin. At the same time, a positioned element might better
placed using top and left properties than margin. [Note javascript style
properties use interCaps spelling to replace CSS hyphenated names.]

<snip>

Would NN4 even understand something like this?


Probably not. NS4 used CSS positioning before it became standardised,
and has multiple errors and inconsistencies with standard CSS.

To understand what NS4 *might* be doing with your percentage values,
take a Header element like
<h1 style="font-size:200%">Hello</h1>
The percentage size is calculated on the default font-size of H1 and not
the containing body (resulting in a font size of 400% for the H1
element.) This taking base percentage from the wrong place and generally
getting inheritance wrong or losing track of it is a big feature of NS4.
Even with care, absolute measurements (px or pt) may be required for NS4.

The other alternative is to put *all* CSS in the stylesheet, and use
@media rules to make sure *none* of it is visible to NS4, which can then
render using its default style sheet and present like a version 3 browser.

Dom

Jul 20 '05 #2
On Fri, 04 Jul 2003 14:25:02 +0930, Dom Leonard
<do*************@senet.andthis.com.au> wrote:
Ian Rastall wrote:

The site is a header (which is a table) and a main <div> underneath
that. The main <div> is set to have a top margin of 3%, which works
fine, except in NN4. There, it looks like it has a margin of 20%, or
even larger.

I tried something like this:

<script language="JavaScript" type="text/javascript">
if (document.layers) frank.styles.margin-top = "-20%"

AFAIK you can only access a DIV element through javascript in NS4 if it
is positioned.


Thanks, Dom. I might give relative positioning a shot, although I'll
never mess with absolute positioning again. The last thing I want is
to mess up the site on every other browser. It isn't like NS4 is being
used that much anymore.

It's the allure of desktop-publishing-style consistency. I have that
with every other browser I've tested.

Thanks again,

Ian
--
http://www.aspipes.org/
http://www.bookstacks.org/
Jul 20 '05 #3
On Fri, 04 Jul 2003 01:22:26 -0400, Ian Rastall
<id*******@earthlink.net> wrote:
Thanks, Dom. I might give relative positioning a shot


Sorry to respond to my own post ... and man, I hate to post this on a
JavaScript ng, but I found a solution (in CSS). This is a hack I ran
across on a Google search. If you were to type:

div.text {/;margin-top: 3%;}

every browser would understand this *except* for NS4. So there you go.
I now return you to a JavaScript discussion. <grin>

Ian
--
http://www.aspipes.org/
http://www.bookstacks.org/
Jul 20 '05 #4
On Fri, 04 Jul 2003 12:02:01 +0200, Martin Honnen
<Ma***********@t-online.de> wrote:
Thus if you have a div that is not positioned no script in NN4 is able
to change any style of it.
Even if the div were positioned you could only change the visibility and
the clipping but not margins.


Thanks, Martin.

Ian
--
http://www.aspipes.org/
http://www.bookstacks.org/
Jul 20 '05 #5

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

Similar topics

8
by: Daniel Hansen | last post by:
I know this must seem totally basic and stupid, but I cannot find any reference that describes how to control the spacing between <p>...</p> and <div>...</div> blocks. When I implement these on a...
61
by: Toby Austin | last post by:
I'm trying to replace <table>s with <div>s as much as possible. However, I can't figure out how to do the following… <table> <tr> <td valign="top" width="100%">some data that will...
4
by: nick | last post by:
The structure is very simple: <div style="WIDTH: 500px; HEIGHT: 50px; BACKGROUND-COLOR: aqua"> <div id="nav"> <a href="#">menu1</a> </div> </div> I want to let the "nav" div sink at the...
5
by: Stan R. | last post by:
Greetings. I have a couple of questions concerning CSS layouts, as apposed to the old <tablemethod for creating layouts . Even after spending the last few days searching all over Google Groups, I...
28
by: Kent Feiler | last post by:
1. Here's some html from a W3C recommendations page. <P>aaaaaaaaa<DIV>bbbbbbbbb</DIV><DIV>cccccccc<P>dddddddd</DIV> 2.Although I didn't think it would make any difference, I tried it with the...
1
by: KoosHopeloos | last post by:
L.S., I'm trying to make a layout which is completely fixed in width and height if needed by using three divs rows (header, content, footer) which have each 3 div again to be able to play around...
5
by: Agix | last post by:
Hi there, Please check out : http://clarifysolutions.co.uk/certenroll/ The source is included below. This page is a test, so I can play about with paddings, margins and layouts using divs as...
5
nathj
by: nathj | last post by:
Hi All, I'm working on a new site that has a two column layout underneath a title bar. If you check out: http://www.christianleadership.org.uk/scratch/mainpage.php using IE or Opera you will...
8
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...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.