zygoma — 2012-11-22T04:05:37-05:00 — #1
Buon Giorno from 8 degrees C wet & Damp wetherby UK
OK... pn this page http://tutorial.davidclick.com/philpotts-clone.html i wanted the gorizontal nav to sit exactly half way across the header wrapper. I achieved this by pushing it down with a top margin eg:
Illustrated here - http://i216.photobucket.com/albums/cc53/zymurgy_bucket/postion-navcopy.jpg
So mY question is please could I have done this any other way or is my approach of forcing the horizontal nav southwards using margin top OK.
ralphm — 2012-11-22T04:30:32-05:00 — #2
It seems fairly safe, though generally fixed heights, top and bottom px margins etc are asking for trouble. In this case, it seems pretty harmless, though.
chris_upjohn — 2012-11-22T05:17:04-05:00 — #3
Personally I would offset the parent container by 50% and set the top margin as a negative value based on half the height of the navigation bar itself as it will always ensure that the navigation container sits vertically centered regardless of if the parent height changes.
Also on a side not I highly recommend you NEVER use floats to clear containers as you will cause yourself headaches later on down the track, whenever you have a parent container with floated child elements always try to use overflow: hidden or a .clearfix method which are much easier to work with and ensure a consistent layout in all browsers.
zygoma — 2012-11-22T06:14:26-05:00 — #4
"I highly recommend you NEVER use floats to clear containers" - Yes thank you ia eas worried about that know i have the theory, big thank you