treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] Div won't respond to a specific change in margins

  • I'm trying to change my footers margin so that it expands to the width of the webpage, instead it still seems to be affect by the 50px of left/right margin I added to my #content section. What property am I missing here so I can remove the affect of the content margins on my footer section?

    http://codepen.io/Austin-Davis/pen/rLeEi

  • One of your closing divs was missing the backslash, which meant that two divs (the original #note and the one created by mistake) were not closed, effectively forcing the #footer into the #content.

    I'm going to clean things up and make some suggestions in a following post - stay tuned!

  • Thanks I'm glad it was just the a missing closing div. Much appreciated, and I can't wait for your future suggestions.

  • Okay, here it is.

    I see you've used box-sizing: border-box; which isn't bad, but I feel you should learn the box model in and out before using this (it has no effect on anything you've done thus far), so I've eliminated it.

    I cleaned up the #header area. I eliminated a lot of unnecessary divs, and to be honest I could eliminate #mast and #below-mast, but kept them there for the time being.

    Classing a div as a header in place of using a header is bad both semantically and for SEO. I changed them all to actual hx tags.

    I've used unordered and definition lists for the pricing - it could definitely be argued that a table is appropriate, but in either case it's better than just a plain div (which holds no semantic value at all).

    Don't wrap a p in a div just to give a class or id, simply apply it to the p instead.

    Don't use break tags for creating spaces - use margins or padding instead.

    I used an unordered list for the footer nav - I think you'll agree it's much cleaner

  • Wow, Ya its much better cleaner, I think it's just since I starting using css I fixated on using it wherever I could, and started to neglect html. Also thanks for the pointing out how div crazy I was getting.