473,657 Members | 2,486 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="JavaS cript" type="text/javascript">
if (document.layer s) frank.styles.ma rgin-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 5043
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="JavaS cript" type="text/javascript">
if (document.layer s) frank.styles.ma rgin-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.lay ers)
document.layers['frank'].style.marginTo p=....;
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%">Hell o</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="JavaS cript" type="text/javascript">
if (document.layer s) frank.styles.ma rgin-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*******@eart hlink.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
14461
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 page, there is a huge gap (like 3/8 inch or 25 px) between them. This is driving me bananas. What the hey am I missing? dh ------------------------------------------------ Dan Hansen ------------------------------------------------
61
24463
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 'stretch'</td> <td valign="top" width="300">some data that won't 'stetch'</td> </tr> </table>
4
8205
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 bottom of the aqua color div. I tried to make the "nav" div 100% height and set "vertical-align:
5
1786
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 haven't not been able to find a solution to my collective dilemma, and I hope some of you fine folks here in these neck of the UseNet woods might be able to share some wisdom with a fellow coder. My questions are in regard to what are the proper...
28
5351
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 </p>s included as well. <P>aaaaaaaaa</p><DIV>bbbbbbbbb</DIV><DIV>cccccccc<P>dddddddd</p></DIV>
1
2716
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 better with the webdesign. The problem is that I need the content div row to nudge up automatically to the header div row, independantly of the header height. The same goes for the footer/content div row.
5
13481
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 semantically meaningless containers for bunch's of other elements - like everyone keeps telling me to make my code standards compliant. This request is not because I want a fix, but because I want to
5
5257
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 see what I am after as these browsers work fine. However, in FF the results are slightly different - take a look and you'll see that the <p>, within <div class="mainContent"> has shot way over to the right. I've been working on this for 2days now...
8
10029
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
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,...
1
6163
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
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
4151
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
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1604
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.