shah Posted April 2, 2009 Share Posted April 2, 2009 Hi, I have a little problem here. When i try to central align div tag witin a page using STYLE margin:0 auto; it automatically puts some vertical pixels. for example if i put a div within a div tag, and use the above code, it will central align it horizontally but will leave some vertical margin before it starts the new div tag. shortly when ever i use the .header { height: 101px; width: 842px; background-color: #F33; } it will align the header horizontally but it will always leave some vertical space (that is top:0 or margin-top:0) will not work whatever i do. kindly help me regarding this problem. BR Syed Arif Ullah Shah Quote Link to comment Share on other sites More sharing options...
nrg_alpha Posted April 2, 2009 Share Posted April 2, 2009 Well, in my stylesheets, I tend to first wipe out all margins, padding and borders with this declaration: html,body,div,div *{margin:0;padding:0;border:0} It has made a difference for me in site construction. Without it, I have had small display issues, and with it added, it fixed it. Try adding that snippet to your stylesheets and see if that helps. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.