html - Center tag works on link but not CSS or align attribute -
i'm trying center button <a>
tag. however, thing work <center>
tag. i've tried using <a style="text-align: center">button</a>
, <a align="center">button</a>
, none of 2 worked. why center tag works?
my css this:
.btn { color: white; background-color: orange; padding: 5px; border-radius: 10px; -webkit-border-radius: 10px; -moz-border-radius: 10px; text-decoration: none; transition: 200ms all; } .btn:hover { background-color: #ffc964; color: white; cursor: pointer; }
html:
<a href="http://example.com" class="btn">button</a>
the <center>
tag deprecated , removed in browsers. , <a>
tag inline in nature, text-align: center
should given it's parent block element:
.make-center {text-align: center;}
<div class="make-center"> <a href="#">i link</a> </div>
in above code, <div class="make-center">
tag acts <center>
tag.
Comments
Post a Comment