-1

I googled this question and searched for an hour, every one specify their own likes, but i want to know the correct code to align the div in center position.

2
  • 2
    This question is better suited (and answered several times) on stackoverflow.com -> stackoverflow.com/search?q=center+div
    – Scott
    Mar 6, 2013 at 14:12
  • As your research has shown, everyone has their own 'likes'--there is no one 'correct' way.
    – DA01
    Mar 6, 2013 at 17:28

1 Answer 1

2

ok if you give your div an id of #centerdiv, the following css should center it

#centerdiv {  margin: 0 auto; }

be aware that you will have to give that div a width value as well

1

Not the answer you're looking for? Browse other questions tagged or ask your own question.