how to center a button vertically code example

Example 1: html center button

button{
    /*Change the width as much as you like, but make sure 
    margin-left and margin-right + width = 100%*/
    width:50%;
    margin-left:25%;
    margin-right:25%;
}

Example 2: how to align buttons vertically in html

<style>/*The Css Code*/
  #test {
    vertical-align: top/middle/bottom; /*your choice*/
  }
  button {
    display: block;/*will place the buttons on seperate lines*/
  }
</style>

<!--The Html Code-->
<div id="test"><!--In order to align buttons you need a container div (or any parent element) with the apropriate style-->
  <button>Button 1</button>
  <button>Button 2</button>
  <button>Button 3</button>
</div>

Tags:

Html Example