How to horizontally center a <div> in another <div>?

--

The answer is

{ margin: 0 auto;}

Look at below the image:

The yellow box <div>icon</div> is located left side.

I wanted to move horizontally center like a title Career Path.

When I checked an inspector, there is a margin space like below:

{ margin: 0 auto;}

{margin: 0 auto;} give the same value to left and right automatically but it doesnโ€™t give any value to the top and bottom.

Thatโ€™t it!!!

Happy coding today!๐Ÿฆ„

--

--

Design & Code Repository
Design & Code Repository

Published in Design & Code Repository

UI / Visual designer who loves CSS. ๐Ÿง™๐Ÿปโ€โ™€๏ธHappy codesign today.๐Ÿ”ฎ

nana ๐Ÿง™๐Ÿปโ€โ™€๏ธ
nana ๐Ÿง™๐Ÿปโ€โ™€๏ธ

Written by nana ๐Ÿง™๐Ÿปโ€โ™€๏ธ

UI / Product designer who loves CSS magic ๐Ÿง™๐Ÿปโ€โ™€๏ธ nanacodesign.com