html - CSS: center elements inside <div> side by side -
i've been trying night center elements without having them stacked on each other:
i've tried floating them left works, but, stick left side no matter did.
html:
<div class="center pages clearfix"> <buuton class="center page-number">1</buuton> <buuton class="center page-number">2</buuton> <buuton class="center page-number">3</buuton> </div>
css:
.center { margin-left: auto; margin-right: auto; } .page-number { display: block; float: none; width: 28px; height: auto; border-radius: 3px; background-color: rgba(0, 0, 0, 0.47); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.34); text-shadow: 0 2px 5px rgba(0, 0, 0, .5); font-weight: 400; line-height: 1.5; text-align: center; color: rgba(255, 255, 255, 0.47); }
just update "display:block
" "display:inline-block
" below updated css
updated css
.center { margin-left: auto; margin-right: auto; text-align:center; }
.page-number { display: inline-block; float: none; width: 28px; height: auto; border-radius: 3px; background-color: rgba(0, 0, 0, 0.47); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.34); text-shadow: 0 2px 5px rgba(0, 0, 0, .5); font-weight: 400; line-height: 1.5; text-align: center; color: rgba(255, 255, 255, 0.47); }
Comments
Post a Comment