Forum Moderators: not2easy

Message Too Old, No Replies

Div using Netscape

Putting div at top of the page using Netscape

         

Adam5000

2:48 am on Jun 2, 2007 (gmt 0)

10+ Year Member



I'm trying to get a div to display at the top of the screen using the Netscape browser, and I've got an example below. I can't get it to go to the top of the screen. I think it's got something to do with padding, but I don't know how to set it. Help!

I'm using the newest version of Netscape, version 8.1.3, that I downloaded from the Netscape website yesterday.

<html>
<head>
<title>div using Netscape browser</title>

<style>
table {cell-padding: 0px;}
p {font-size: 30pt;}
</style>

</head>

<body>
<table width=100%>
<tr>
<td>
<div id="div_one" name="div_one" style="position: absolute; top: 0px; left: 100px;">
<p>This is a div</p>
</div>
</td>
</tr>
</table>
</body>
</html>

JAB Creations

2:59 am on Jun 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<html>
<head>
<title></title>
<style type="text/css">
#header {
border: #000 solid 1px;
}
html, body {
padding: 0px;
}
</style>
</head>
<body>
<div id="header"></div>

</body>
</html>

You may have to set margin to 0px for the html, body too as some browsers refer to the body's padding as margin.

- John

encyclo

3:06 am on Jun 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A couple of things: firstly, forget Netscape, use Firefox. Netscape is just a wrapper around Firefox and as such is not worth the download. Firefox has a much higher profile than Netscape these days.

Secondly, you need the right doctype [webmasterworld.com] when doing anything serious with CSS, see option 1 or 3 from the linked page.

Finally, yes there's a padding problem - there is padding and/or margin on paragraphs, for example. Also, why the table if you are using absolute positioning, as that simply takes the

div
out of the context of the table anyway?

Try this for starters (untested, red border added for clarity):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>div using Netscape browser</title>
<style [b]type="text/css"[/b]>
#div_one {position:absolute;top:0;left:100px;[b]border:1px solid red;[/b]}
p {font-size: 30pt;}
</style>
</head>
<body>
<div id="div_one">
<p>This paragraph is within the div</p>
</div>
</body>
</html>

Adam5000

4:06 am on Jun 2, 2007 (gmt 0)

10+ Year Member



Jab and En. Thanks for your help. That did the trick. When viewed with the Netscape browser, the paragraph had maybe a 20% margin as the default value.
p {margin: 0px;} cleared it up. And I'll check out the Firefox browser and test the page with that one too. But that's maybe next week. For now it's bedtime for me. zzzzzzzzzzzzzzzzzzzzzzzzzzzz