I\'m trying to display two elements on the same line, but in the center. To center them, I had to set margin:auto; However, in order to
elements on the same line, but in the center. To center them, I had to set margin:auto; However, in order to
margin:auto
You can do this, but you'll need an explicit width on your outter div.
Try this example:
.outer { width: 200px; margin: 0 auto; } .inner1 { float: left; background-color: red; padding: 20px; } .inner2 { float: left; background-color: aqua; padding: 20px; }
Hi Stackoverflow
Hope this helps!