Forum Moderators: not2easy

Message Too Old, No Replies

Help with CSS Layout

I need help with my background.

         

MrsRiordan

9:05 pm on Jun 14, 2009 (gmt 0)

10+ Year Member



I am trying to create a dummy web page for a class project. I have a background jpg that I would like to use, only problem is that whenever I enter my content, if it has a 300 px margin-top, the content overflows the background. Here is a copy of the code as it stands.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="Me" />
<meta name="keywords" content="design, css, cascading, style, sheets, xhtml, graphic design, w3c, web standards, visual, display" />
<meta name="description" content="This is my final project for ...." />
<meta name="robots" content="all" />

<title>title</title>
<style type="text/css">

html, body {
margin:0;
padding:0;
width:100%;
height:100%;
}

#bg {
position:absolute;
top:0;
left:0;
z-index:1;
width:100%;
height:100%
}

#content {
position:absolute;
top:0;
left:0;
z-index:2;
width:100%;
height:100%;
}

#paragraph {
margin:300px 251px 0 251px;
padding:0;
border: dotted white;
}

#pageHeader {}
#pageHeader2 {}
#buttons {}
#links {}
#images {}
</style>
</head>
<body>
<div id="bg">
<img src="sky.jpg" alt="Background" width="100%" height="100%" />
<div id="content">
<div id="pageHeader">
</div>
<div id="pageHeader2">
</div>
<div id="paragraph">
<p class="P1"><span>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</span></p>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>
</div>
<div id="buttons">
</div>
<div id="links">
<p><span><a href="#">MySpace</a></span></p>
<p><span><a href="#">Deviant Art</a></span></p>
</div>
<div id="images">
</div>
</div>
</div>
</body>
</html>

Now, I am fairly new to this, so there are probably a million errors with it. Can anyone help? I am pulling my hair out trying to figure this out.

Thank you in advance.

[edited by: SuzyUK at 10:09 pm (utc) on June 14, 2009]
[edit reason] code examplified, specifics removed [/edit]

abidshahzad4u

2:23 pm on Jun 15, 2009 (gmt 0)

10+ Year Member



You code doesn't seem that you are using image as background. To use image as background do the following:

#paragraph {
background-image:url("path to your image");
background-repeat: /* choose whether fixed, repeat x or repeat y */;
background-position: /* specify position like top center */

margin:300px 251px 0 251px;
padding:0;
border: dotted white;
}