Steven
Steven

Reputation: 225

Margin/Padding where there shouldn't be

Web site: http://www.srstage.d19.us

* {
padding: 0;
margin: 0;
}

works, but that is for every element

I've worked out this hacky solution:

#header {
margin-bottom: -30px;
margin-top: -20px;
}

The problem is there is a space at the top and under the header image. However, all the relevant elements including body seem to have its margin & padding set to 0. I'm not sure exactly how to fix this.

Thanks for your help.

Upvotes: 1

Views: 428

Answers (3)

Pekka
Pekka

Reputation: 449823

It's the default padding/margin of the surrounding h1#blog-title element. Force both values to 0, and it should work fine.

As a side note, for the future, Firebug's "Inspect element" and its layout view

alt text
(source: getfirebug.com)

are the perfect tool to find stuff like this.

Upvotes: 1

Alex
Alex

Reputation: 14648

You have margin set for inside elements. They extend to their parents. Use padding when such cases occur. In your case, the h1 in the header has a margin. remove it and it's all set.

Upvotes: 0

Michael Robinson
Michael Robinson

Reputation: 29508

#blog-title{
    margin: 0px;
}

or:

#header h1{
    margin: 0px;
}

Agree with Pekka, http://getfirebug.com/ is essential!

Upvotes: 1

Related Questions