Garath531 Posted June 13, 2007 Share Posted June 13, 2007 I have a div with an id of pic and I want it to float in the center. Here's the code I have. #pic { position: fixed; margin-left: auto; margin-right: auto; width: 60px; background-color: #FFFFFF; } It worked up until I put in "position: fixed" then everything just completely disappeared. Does anyone know why? Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted June 14, 2007 Share Posted June 14, 2007 remove the poistion fixed Quote Link to comment Share on other sites More sharing options...
Garath531 Posted June 14, 2007 Author Share Posted June 14, 2007 It works fine then, but it needs to be fixed. Quote Link to comment Share on other sites More sharing options...
Jago6060 Posted June 14, 2007 Share Posted June 14, 2007 try defining the top: and left: positioning attributes instead of using margins. Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted June 14, 2007 Share Posted June 14, 2007 problem with using css position fixed here is that different screen resolutions will appear to display the box at different positions. 800x600 may be centred but any increase in resolution would appear to drive the box toward upper left - unless you have this box positioned inside a fixed width element with position: relative;... Quote Link to comment Share on other sites More sharing options...
mainewoods Posted July 2, 2007 Share Posted July 2, 2007 position: fixed; does not work in ie < 7, you must use position:absolute; for ie < 7 Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted July 2, 2007 Share Posted July 2, 2007 ie 6 will act like you have used position: absolute so you don't have to change your css - just be ready for it not doing what you expect! 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.