Solved

How to position table in Netscape without margins?

Posted on 2002-07-07
23
171 Views
Last Modified: 2010-04-09
I have been trying to put a table at the very top and left of my page. I can get this to look beautiful in IE 6
but Netscape 4.78 does not display the table at the absolute top and left. I've tried fixing this in html and even css (I'm a beginner css'er) with no luck. Any help would be greatly appreciated! Thanks, Emory.

<div align="left">
<table position:absolute; left:0; top:0; bgcolor="black" width="700">
  <tr>
    <td bgcolor="green">Test</td>
  </tr>
</table>
</div>
0
Comment
Question by:emory7
  • 8
  • 5
  • 5
  • +2
23 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
Comment Utility
Try this in the head of the page:

<style>
   body, div, table {margin:0px 0px 0px opx}
<style>

Cd&
0
 

Author Comment

by:emory7
Comment Utility
That doesn't seem to have any effect on it. I also closed the last <style> tag. Thanks.
0
 
LVL 18

Expert Comment

by:bruno
Comment Utility
If you just put a table as the first thing in your page, it should show top and left....

otherwise, NS 4.x doesn't have very good support for positioning....


Where is the table in your code, and where is it showing up on the page?  Need more info on the problem

BRUNO
0
 

Author Comment

by:emory7
Comment Utility
Yeah, the table is the first thing. Here's the latest code I've been working with, thanks:

<html>
<head>
<title>Test</title>

<body>

<table>
  <tr>
    <td bgcolor="green" width="700">Test</td>
  </tr>
</table>

</head>

</body>
</html>
0
 

Author Comment

by:emory7
Comment Utility
Yeah, the table is the first thing. Here's the latest code I've been working with, thanks:

<html>
<head>
<title>Test</title>

<body>

<table>
  <tr>
    <td bgcolor="green" width="700">Test</td>
  </tr>
</table>

</head>

</body>
</html>
0
 
LVL 18

Expert Comment

by:bruno
Comment Utility
and what problem are you experiencing with that?  just a slight margin at the top and left of the page?


this is not correct code going forward, but if you are coding for an older browser, this should work....


<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">


BRUNO
0
 

Author Comment

by:emory7
Comment Utility
That does move the table almost flush with the left corner. However, in IE 6 it pushes it down somewhat. If I don't find a better solution, I'll accept that. Thanks very much. Emory
0
 
LVL 18

Accepted Solution

by:
bruno earned 200 total points
Comment Utility
ok, here is your whole page...


<html>
<head>
<title>Test</title>

<style>
/* this removes the page margins */
body {
margin-left: 0px;
margin-top: 0px;

}
</style>

</head>  <!-- You left this tag out before as well -->

<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">

<table>
 <tr>
   <td bgcolor="green" width="700">Test</td>
 </tr>
</table>

</head>

</body>
</html>
0
 
LVL 19

Expert Comment

by:webwoman
Comment Utility
I wouldn't bother with the one in the style. The one with the body tag should do it.

Also make sure you don't have any extra space after the body tag but before the table. Don't put a div around it unless you give it a position of 0,0. Take the position out of the table tag, it doesn't belong there.
0
 
LVL 18

Expert Comment

by:bruno
Comment Utility
ww,

according to emery, the one in the body tag didn't fully do it in IE 6..


The one in the style will, and the one in the style is the correct way to do it going forward, as ALL those tags within the body tag are not correct within XHTML.



BRUNO
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
<table style="position:absolute; left:0; top:0; border-spacing:0;border-collapse:collapse;margin:0;padding:0;" bgcolor="black" width="700">
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
oops, didn't see the 4.78 in you question before sending.
My suggestion does not work for Netscape 4.x.
AFAIK there is no solution for Netscape 4.x at all.
0
 
LVL 19

Expert Comment

by:webwoman
Comment Utility
Sure there is. Take out the div, take out the position in the table, set the marginheight/width in the body tag. Make sure there's no space, no gap, NOTHING between the body tag and the table. If you DO leave the div, make SURE you set the position on THAT.

Works for most 4.x versions of Netscape. Probably not all, but comes closest.
0
 
LVL 19

Expert Comment

by:webwoman
Comment Utility
And I suspect that the reason it's not working in IE6 is the div tag... though I don't have it to check. The style SHOULD work for it, but again, I don't have it to check.
0
 
LVL 18

Expert Comment

by:bruno
Comment Utility
You guys are NOT paying attention.  

In the latest code that emory posted, there was NO div tag.

If the last code I posted doesn't work, nothing will.



BRUNO
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
BRUNO's suggestion works for Netscape 4.x with following change:

<TABLE CELLPADDING="0" CELLSPACING="0">
0
 
LVL 18

Expert Comment

by:bruno
Comment Utility
those should not affect the outside of the table.
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
In theory theory and praxis are the same, in praxis they are not. :-o
0
 
LVL 18

Expert Comment

by:bruno
Comment Utility
*L*
0
 
LVL 19

Expert Comment

by:webwoman
Comment Utility
Good catch... Netscape will put in both cellpadding and cellspacing unless told otherwise, and if you don't have a border on, it will look like the space is around the table rather than inside it. ;-)

And make sure there's no space after the body tag... I've been burned by that one before. The table tag can start on the next line, but no extra blank lines.
0
 

Author Comment

by:emory7
Comment Utility
Thanks to all of you for your help! I really appreciate it. Bruno gets the cigar with WW and ahoffman honorable mention.
0
 
LVL 18

Expert Comment

by:bruno
Comment Utility
:-)  Thanks emory, glad we could help you!
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
> And make sure there's no space after the body tag...
hmm, that's not necessary on UNIX/Linux, probably on M$ systems.

BTW, I have the feeling that cellspacing and cellpadding in Netscape 4.x (and even 6.x, 7.x) also behaves like CSS' border-collapse and border-spacing. Unfortunately I never found docs about the rendering algorithm for 4.x browsers.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
html select on change 3 25
use month from current date as default for select list 3 25
Paper tearing animation 6 37
SVG Logo 4 16
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now