I'm facing an issue with a button and the text inside it. When I center the button using display:block
, the button is centered but the text breaks into two lines instead of staying in one line. Here's my code:
<div class="MyClass"><a type="button" style="margin:auto; display:block" class="ButtonLink" href="@Url.Action("MyAction","MyController")">Selected Now</a></div>
If I remove the display:block
to keep the text in one line, the button isn't centered as desired:
<div class="MyClass"><a type="button" class="ButtonLink" href="@Url.Action("MyAction","MyController")">Selected Now</a></div>
This is what I want to achieve:
https://i.sstatic.net/z7VXu.png
However, this is how the text appears when I try to center the button:
https://i.sstatic.net/0Ws4S.png
Any suggestions on what changes need to be made?