...

View Full Version : margin css-code



kstanf1998
08-17-2003, 06:22 AM
I have tried some margin commands to correct this.Now i am at a total loss on how to do it.

I want the header on top to stretch all the way across,leaving rest of page white.

if anyone can help

thank you

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<div style="margin-left: 0px; margin-right: 0px;; width: 100%; height: 15%; border:0; background: #deb887;"><!--HEADER-->
<CENTER><h3>THIS IS A HEADER FOR NEW SITE</h3></CENTER>
</div>
</body>
</html>

MotherNatrsSon
08-17-2003, 08:08 AM
This work in Netscape 7 and IE 5.1.7 on my MAC.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<style type="text/css">
html>body{
width: 100%
}
</style>
</head>
<body style="margin: 0px; padding: 0px">
<div style="position: absolute; margin-left: 0px; margin-right: 0px;; width: 100%; height: 15%; border:0; background: #deb887;"><!--HEADER-->
<CENTER><h3>THIS IS A HEADER FOR NEW SITE</h3></CENTER>
</div>
</body>
</html>

MNS

giz
08-17-2003, 09:24 AM
The four margin errors can be replaced with a little bit of CSS code instead. Put this is a text file, with a name ending in .css:

body {
margin: 0px;
padding: 0px;
}




You should export the CSS to an external file and call it with instructions in the <head> section of the HTML file. Most people use this one, but it can cause problems:

<link type="text/css" rel="stylesheet" src="/path/file.css">

It is better to use this slightly longer version of this, again placed in the <head> section of the HTML file:

<meta http-equiv="Content-Style-Type" content="text/css">

<style type="text/css">
@import url(path/file.css);
</style>

This version hides the CSS from older versions of Netscape that cannot handle CSS. This stops those versions from displaying a corrupted page with overlapping elements.

MotherNatrsSon
08-17-2003, 04:28 PM
Originally posted by giz
The four margin errors can be replaced with a little bit of CSS code instead. Put this is a text file, with a name ending in .css:

body {
margin: 0px;
padding: 0px;
}




You should export the CSS to an external file and call it with instructions in the <head> section of the HTML file. Most people use this one, but it can cause problems:

<link type="text/css" rel="stylesheet" src="/path/file.css">

It is better to use this slightly longer version of this, again placed in the <head> section of the HTML file:

<meta http-equiv="Content-Style-Type" content="text/css">

<style type="text/css">
@import url(path/file.css);
</style>

This version hides the CSS from older versions of Netscape that cannot handle CSS. This stops those versions from displaying a corrupted page with overlapping elements.

Putting that little snippet in alone will not do it. Try it out and see. What I posted above works. It needs the html>body width 100% to work.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum