How to horizontally center an element
Asked 07 September, 2021
Viewed 1.9K times
  • 65
Votes

How can I horizontally center a <div> within another <div> using CSS?

<div id="outer">
  <div id="inner">Foo foo</div>
</div>

30 Answer