How does one center-align a button using Materialize CSS?
You can center the button using materialize class center-align, but use it on <p>
or <div>
tag. since <a>
tag is inline-block tag.
Here is the code.
<p class="center-align">
<a class="waves-effect waves-light btn-large blue"><i class="material-icons right">cloud</i>Enter</a>
</p>
Vertical Alignment:
Use a wrapper and give the wrapper a class of .valign-wrapper
<div class="valign-wrapper">
<h5>This should be vertically aligned</h5>
</div>
Horizontal Alignment:
Use .left-align
, .right-align
, .center-align
on the element to be centered.
See documentation.
Add 'center' class to the surrounding div:
<div id="div" class="row center">
<a class="waves-effect waves-light btn-large blue"><i class="material-icons
right">cloud</i>Enter</a>
</div>
Note - div must also have the 'row' class.