Wednesday, 15 May 2013

html - Why margin:auto doesn't work? -



html - Why margin:auto doesn't work? -

this question has reply here:

center <div> , display on same line 3 answers

i want center element when utilize

margin-left: auto; margin-right: auto;

it doesn't work!

this html

<section id="t"> <article class="tc">hi</article> <article class="tc">hi agian!</article> </section>

and css:

#t { margin-left: auto; margin-right: auto; margin-top:10px; } .tc { margin-left: auto; margin-right: auto; width: 600px; display: inline; border-style: solid; border-width:1px; }

and can see result here.

can help me?

margin-left: auto; margin-right: auto;

would not effect element width display:inline.

if want works, should give fixed width, , set display:block or display:inline-block.

html css

No comments:

Post a Comment