Hydrian Posted September 2, 2012 Share Posted September 2, 2012 I have a div which needs to be in the center but it acts as if there is a div in the way. here is my css http://pastebin.com/AUwdVnkn here is my index http://pastebin.com/SMR1QNWw Quote Link to comment https://forums.phpfreaks.com/topic/267917-alignment-not-working/ Share on other sites More sharing options...
hakimserwa Posted September 2, 2012 Share Posted September 2, 2012 whats the name of the div Quote Link to comment https://forums.phpfreaks.com/topic/267917-alignment-not-working/#findComment-1374715 Share on other sites More sharing options...
Hydrian Posted September 2, 2012 Author Share Posted September 2, 2012 content Quote Link to comment https://forums.phpfreaks.com/topic/267917-alignment-not-working/#findComment-1374718 Share on other sites More sharing options...
spiderwell Posted September 3, 2012 Share Posted September 3, 2012 content is float left Quote Link to comment https://forums.phpfreaks.com/topic/267917-alignment-not-working/#findComment-1374855 Share on other sites More sharing options...
White_Lily Posted September 3, 2012 Share Posted September 3, 2012 okay - simple thing to solve. In the CSS file replace "float:left;" with: margin: auto; Quote Link to comment https://forums.phpfreaks.com/topic/267917-alignment-not-working/#findComment-1374871 Share on other sites More sharing options...
matthewtbaker Posted October 26, 2012 Share Posted October 26, 2012 margin: 0 auto; is the answer. You do seem to have a lot of: Used within your layout. Perhaps consider a different method which is friendly for mobile browsers. Quote Link to comment https://forums.phpfreaks.com/topic/267917-alignment-not-working/#findComment-1387859 Share on other sites More sharing options...
codefossa Posted October 26, 2012 Share Posted October 26, 2012 (edited) As Matthew said, you should use margin: 0 auto; to center an element. Also, if you're trying to float something under another floating object, you would use clear: {left, right, both};. Only one of them though, obviously. Edited October 26, 2012 by Xaotique Quote Link to comment https://forums.phpfreaks.com/topic/267917-alignment-not-working/#findComment-1387867 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.