0

I want to center two buttons to the center of a page. The following is my code. It centers only the btnExport at the center but not the btnReset, it always stays at the left. When I tried pull-right or pull-left at the row level both buttons correctly go to left or right!

<div class="row" style="padding-right: 18px; margin-left: auto; margin-right: auto">
  <div style="text-align: center">
    <asp:button SkinID="whiteButton" id="btnReset" runat="server" CausesValidation="false" Text="Reset" onclick="btnReset_Click"></asp:button>
    <span>&nbsp;</span>
    <asp:button SkinID="blueButton" id="btnExport" CausesValidation="false" runat="server" Text="Export"></asp:button>
    <input class="hidden" type="button" name="btnPrint" id="btnPrint" onClick="printDiv('divInvoiceGrid');" value="Print">
  </div>
</div>
th1rdey3
  • 4,176
  • 7
  • 30
  • 66
Massey
  • 1,099
  • 3
  • 24
  • 50

3 Answers3

2

You could create a center class in your CSS and add it to the div that contains the two buttons.

.center {
   margin: auto;
   width: 50%;
   padding: 10px;
}

http://www.w3schools.com/css/css_align.asp

Richard P
  • 46
  • 4
0

Text-align center will just center the text, if I understand you want to center the buttons.

try using bootstrap col-xx and col-xx-offset.

<div class="row" style="padding-right: 18px; margin-left: auto; margin-right: auto">
   <div class="col-md-4 col-md-offset-4">
        <asp:button  SkinID="whiteButton" id="btnReset" runat="server" CausesValidation="false" Text="Reset" onclick="btnReset_Click"></asp:button>
        <span>&nbsp;</span>
        <asp:button SkinID="blueButton"  id="btnExport" CausesValidation="false" runat="server" Text="Export"></asp:button>
        <input class="hidden" type="button" name="btnPrint" id="btnPrint" onClick="printDiv('divInvoiceGrid');" value="Print">
   </div> 
</div>
th1rdey3
  • 4,176
  • 7
  • 30
  • 66
John Doe
  • 3,053
  • 17
  • 48
  • 75
0

did u try ?

.row { display: flex; justify-content: center; align-items: center; }

It would be more helpful if you could pics with what u got and what u are trying to do.

Mike Trinh
  • 1,271
  • 2
  • 9
  • 19