1

Basically I got problem with the edge of my website, it got this white spaces :

http://sadpanda.us/images/1885204-15X1WA4.jpg

While I want that web to look like this :

http://sadpanda.us/images/1885205-VG8KJ23.jpg

no white spaces.

Any idea where I've done wrong?

1
  • You're probably not using a reset stylesheet. Be aware, that browsers will use their own default styles for various elements, like <body> for example - meyerweb.com/eric/tools/css/reset it's usually a good idea to use something like reset.css or normalize to start with a consistent baseline. Commented Feb 11, 2014 at 15:07

2 Answers 2

3

That looks very much like the default margin on the <body>.

body {
  margin: 0;
}

Should solve it for you.


Quick Demo:

CSS:

html, body {
    height: 100%;
}
div {
    width: 100%;
    height: 100%;
    background: #ddd;
}

DEMO WITH SPACE

CSS:

html, body {
    height: 100%;
}
body {
    margin: 0; /* This will stop the margin, setting it to 0 */
}
div {
    width: 100%;
    height: 100%;
    background: #ddd;
}

DEMO WITHOUT SPACE

Sign up to request clarification or add additional context in comments.

1 Comment

Added onto your answer, hope you don't mind. Just added a demo.
0

each browser has some style for elements like body,h1...etc,that is called as user agent style sheet, they have some margin, if you want reset all css just use universal tag and put margin:0 ... like below..

*{ margin: 0;}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.