473,226 Members | 1,595 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,226 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 5015
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: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

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.