0

i have a button inside a div which is currently at the top of the div. I want to center it vertically inside iths parent div.

.button-login {
    background-color: white;
    border: 2px solid #01BDE0;
    border-radius: 4px;
    color:#01BDE0;
    width: 100%;
    height:46px;
    vertical-align: middle;
    font-size: 1vw;
    display: block;
}

This is css for button.

<div class=" pure-u-1 pure-u-md-2-24"><button class="button-login">LOG IN</button></div>

This is the html part.

I tried vertical align its not working.

nidhinpd
  • 93
  • 1
  • 4
  • It works here: https://plnkr.co/edit/ukqpHF2pX33sepNqrOfd?p=preview Maybe in the "pure-u-1 pure-u-md-2-24" classes you run something over. – Offir Jun 26 '16 at 11:07

2 Answers2

0

Try This...

    <style>
      .pure-u-1 { width:100%;}

      .center {height: 500px; background-color: #222;}

     .vertical-align  {position: relative; top: 50%; transform: translateY(-50%); } 
    </style>



    <div class=" pure-u-1 pure-u-md-2-24">
  <div class="center" align="center">
    <div class="vertical-align">
    <button class="button-login">LOG IN</button>
   </div>
  </div>
</div>
Ammy Dua
  • 63
  • 1
  • 1
  • 10
0

.video-contant {
    position: absolute;
    background: rgba(7, 7, 7, 0.52);
    width: 100%;
    top: 0px;
    height: 100%;
    display: table;
  
}
.hctr {
    display: table-cell;
    vertical-align: middle;
    text-align: center;
    color: #fff;
    width: 100%;
    overflow: hidden;
}
<div class="video-contant">
    <div class="hctr">
     <button>onewebbell.com<button>
  </div>
</div>
Naved Khan
  • 1,699
  • 16
  • 13