#container { position: relative; width: 1000px; height: 600px; border: 1px solid #ccc; overflow: hidden; margin: 0 auto; display: flex; align-items: center; justify-content: center; } #randomButton { position: absolute; } .btn { background:blue; color:#ffffff; width:100px; height:30px; text-align:center; overflow:hidden; display:block; margin:0 auto; } .btn:hover { opacity:0.7; } #counter { text-align:center; } .buttonadd{ }