How do I center a button in html5? by modify the css file. I don't want to use the center tag in the html code.
a.read{
padding:10px 20px;
font-size:14px;
line-height:20px;
background-color:#eba73c;
text-align:center;
color:#fff;
border-radius:5px;
text-decoration:none;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
text-align:center;
display:inline-block;
clear:both
}
You can apply these styles to the anchor to make it block-level, assign a width, and then adjust its margins like this:
a.read{
display:block;
width:100px;
margin:0 auto;
}
Or apply this to its parent element:
.parent{
text-align:center;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With