Click to See Complete Forum and Search --> : Div Problem


cs05pp2
10-06-2009, 09:50 AM
Hello, I am new in html and I am trying to create my website.

I trit to do this:
================================
index.html:


....
<body>
<div id="_pi">
....
</div>
</body>


================================

mycss.css:



#_pi
{
margin: 0 auto;
background: #f4f4f4 url(../images/bg.gif) top center repeat-y;
width: 100%;
height: 100%;
}



=============================

When I open with internet explorer my site the <div id="_pi"> is not full screen, It has an empty space like header and footer. Why, And how I can fix it?

tracknut
10-06-2009, 10:29 AM
You might add:

* { padding:0;margin:0}

to your css file, to clear the default padding and margins on everything. It could be that's what you're calling a header and footer?

Dave

Nihiliste
10-06-2009, 10:29 AM
If you want a fullscreen background effect don't use a <div> that include all other page elements. Instead you should use the <body> and CSS it.

In your case something like that should do the job:


body {
background: #f4f4f4 url(../images/bg.gif) top center repeat-y;
}



MGB

cs05pp2
10-06-2009, 11:04 AM
You might add:

* { padding:0;margin:0}

to your css file, to clear the default padding and margins on everything. It could be that's what you're calling a header and footer?

Dave

Thank you. It works. What padding means?

tracknut
10-06-2009, 12:31 PM
Thank you. It works. What padding means?

Padding is extra space around the inside of the div, whereas margin is extra space around the outside of the div.

Dave