CSS - How to remove white
margins


Tags: html,css,image

Problem :

I've placed a picture on my html page but it lefts some white margins at the top and on both sides. How do I remove those? I've tried setting margins to zero.

body div:nth-child(1) {
    background-image: url('/resources/picture.jpg');
}



Solution :

maybe your body has some margins.

Try adding this css -

body, img{
    margin:0;
    padding:0;
}

    CSS Howto..

    How to make an empty div or container glow with pure CSS?

    how to get text beside image button using CSS

    How to wrap text without whitespace? [duplicate]

    How to isolate CSS rules inside a div?

    How to reduce div size in CSS using twitter bootstrap?

    How to select a child element inside a div using CSS

    How to apply an image to a CSS ordered list in WordPress?

    How to make CSS border-image work

    How to add hover text on D3 disign?

    How to differentiate between high-res phone and desktop using css or js or anything else?

    How to set background color in border in CSS

    How to create desktop widgets [closed]

    jQuery + CSS: How to scroll smooth, regarding a fixed header?

    How can I select the first IFRAME within the second FB tag in a div?

    How to make this layout more responsive in CSS?

    How to change the opacity of image on hover using css

    How to make one side of a div pointy with CSS?

    How to hide text without ID?

    Keyboard Showed messed up elements' position

    How to stretch a div to the viewport bottom without using absolute positioning?

    How to let the user choose a page number?

    How to keep nav menu highlighted after click using js in sidebar

    CSS: How to select first element in each row?

    How can I change the text decoration on numbers only on my web page?

    How can I load dynamically typekit fonts?

    CSS how to height step arrow

    How do I draw a line in CSS that starts wide and ends in a point [duplicate]

    How to route requests in codeigniter so we can serve static css, js and img files?

    @media query device - how to portrait one css, landscape other?

    How can I make Non-English quotation marks with a help of CSS? [closed]