Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

stephanie harrison roberts
stephanie harrison roberts
1,713 Points

getting rid of margins on a full page background image in HTML&CSS

Hello all! I'm trying to get rid of any white space around the background image.....i tried margins: auto;, and that didnt work, any suggestions? Code below!

Thanks alot, Steph

<html>
<head class="main-head">
    <title>Coding Mama</title>
         <link rel="stylesheet" href="Background.css">
            <meta name="description" 
            content="A general guide on the use of meta tags in html pages">

</head>
<body>
    <img src="Brackets_Images/redgrafitti.jpg" class="background_image">

</body>
.background_image{
    width: 100%;
    height: 100%;
    position: fixed;
}

3 Answers

Adam Beer
Adam Beer
11,314 Points

Try this:

display: block;
stephanie harrison roberts
stephanie harrison roberts
1,713 Points

Hello Adam, Hope you're well? Thanks for that, its now working, phew!!

steph

Adam Beer
Adam Beer
11,314 Points

Sounds good. Yes I'm fine! And you? Have a nice day!

stephanie harrison roberts
stephanie harrison roberts
1,713 Points

Yes all good so far today thanks...no doubt I'll be calling on your expertise before to long! :)