HTML CSS examples for CSS Layout:Flex Center
Float one item to the left while centering a second in flexbox
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .top_bar { text-align: center; border: 1px solid black; padding: 10px; height: 80px; width: 300px } .a {<!--from w w w.j av a 2 s. c o m--> float: left; border: 1px solid yellow; width: 20px; height: 30px } .b { border: 1px solid red; width: 50px; height: 30px; margin: auto } </style> </head> <body> <div class="top_bar"> <div class="a"> hi </div> <div class="b"> yo </div> </div> </body> </html>