Lucas Phillips
Lucas Phillips

Reputation: 645

div not centering with margin: auto?

I've got one fixed div that's 100% screen width, and another one inside it that's set to a width in pixels. For some reason, even though it has width: auto, it's aligning left:

http://jsfiddle.net/jv87N

I can't think of any reason that the margin: 0px auto; wouldn't work.

Upvotes: 1

Views: 93

Answers (1)

codingrose
codingrose

Reputation: 15699

Remove fixed position from #nav.

margin:0 auto does not work with absolute/fixed position.

Updated fiddle here.

Upvotes: 3

Related Questions