how can i horizontally minimize this menu http://codepen.io/anon/pen/bZWOQk please wrap menu in a div. the div wrap should shrink if minimized horizontally pls. Solution body { background: orange; } * { margin: 0; padding: 0; font-family: \'Roboto\', sans-serif; box-sizing: border-box; } nav { position: absolute; top: 50%; left: 50%; width: 300px; background: #3a3a3a; font-size: 16px; transform: translateX(-50%) translateY(-50%); box-shadow: 0 0 10px rgba(0,0,0,0.9); } nav input[type=checkbox] { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; display: block; cursor: pointer; } nav ul { margin: 0; padding: 0; } nav a { display: block; padding: 15px 20px; color: #fff; text-decoration: none; } nav li { position: relative; float: left; width: 100%; list-style: none; color: #fff; transition: 0.5s; border-top: 1px solid #555; } nav li:first-child { border-top: none; } nav ul > li.sub > a:after { position: relative; float: right; content: \'+\'; margin-top: -0.1em; font-size: 1.2em; vertical-align: middle; transition: 0.5s; } nav li:hover { background: #4096ee !important; } nav .submenu { max-height: 0; overflow: hidden; border-top: none; transition: max-height 0.5s ease-in-out; } nav input[type=checkbox]:checked ~ .submenu { max-height: 999px; border-top: 1px solid #555; } nav input[type=checkbox]:checked ~ a:after { transform: rotate(45deg); } nav .submenu a { padding: 10px 20px; } nav .submenu li { list-style-position: inside; list-style-type: square; background: #333; } nav .submenu li.sub { list-style: none; } nav .submenu li li { background: #3a3a3a; } nav .submenu li li li { background: #2a2a2a; } .