search

Home  >  Q&A  >  body text

Teacher, why is the div not centered after I give it a random width with margin:auto?

Master, why is the div not centered after I give it a random width with margin:auto?

永~不~低~头永~不~低~头2207 days ago1586

reply all(1)I'll reply

  • 鸿运达

    鸿运达2018-12-21 17:48:24

    <section style="width:100%; float:left;">
    <div style="width:1000px; height:500px; background:#f00; margin:0 auto;"></div>
    </section>

    Is this so?


    reply
    0
  • Cancelreply