Many criticize the center
tag, but I find that it consistently aligns things perfectly for me. Despite its deprecation, I still rely on it.
I've come across suggestions to use the mysterious CSS margin: 0 auto;
, but I struggle to make it work (refer to fiddle here). Others recommend tweaking the position
or display
, but that often leads to unintended consequences.
Is there a way to center a span
using css that replicates the behavior of the center
tag?
<div class="container">
<span class='btn btn-primary'>Click me!</span>
</div>