HTML & CSS
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.
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.
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.
"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
This topic is now closed. New replies are no longer allowed.