Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jan 2012
    Posts
    18
    Thanks
    5
    Thanked 1 Time in 1 Post

    question about setting a footer background image

    i have an image i want to set up as the background for the footer but i have to set the margin-bottom to -40px for it to be all the way at the bottom of the screen... will i run into any problems for making it negative? or is this fine?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    will i run into any problems for making it negative?
    Why don't have a try?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New Coder
    Join Date
    Jan 2012
    Posts
    18
    Thanks
    5
    Thanked 1 Time in 1 Post

    Cool

    ok so your telling me if it works it works,if it looks how i want it to then its good?

    thats great common sense but it's not what im asking here

    what im asking is ...
    Is it BAD PRACTICE to use negative margins for things like this?

    THANKS in advance for any replys

  • #4
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,721
    Thanks
    41
    Thanked 191 Times in 190 Posts
    moreover depends on how your footer is set up... it is weird to me that you need to set that at all... how are you setting up your footer? if your footer is set up correctly then all you should need to do is set the footer div background to your image- there should be no need to set negative margin.

    If you are setting up your footer like as something like this...
    Code:
    .wrapper{
      style....
      margin-bottom: -40px;
    }
    .footer{
      style...
      height: 40px;
    }
    
    .....
    
    <div class="wrapper">
    ....
    </div>
    <div class="footer">
    </div>
    then that is an acceptable way to set up a footer

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #5
    New Coder
    Join Date
    Jan 2012
    Posts
    18
    Thanks
    5
    Thanked 1 Time in 1 Post
    Code:
    #footer{
    	height:78px;
    	margin-top:60px;
    	margin-bottom:-40px;
    }
    
    #footerbg{
    	background:url(images/footer.png);
    	width:948px;
    	height:78px;
    	
    }
    Code:
    <div id="footer">
    	<div id="footerbg"></div> 
    </div>
    yea thats how i set it up but i used ID instead of class since im only useing it once

  • #6
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    There's nothing wrong in using a negative margin and there's no general rule related with margins and backgrounds.

    Always test the output in some standard browsers like FF/Chrome/Safari etc and in some other browsers like IE8/9/10 , to make sure that it's okay.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •