html - CSS: center elements inside <div> side by side -


i've been trying night center elements without having them stacked on each other:

enter image description here

i've tried floating them left works, but, stick left side no matter did.

enter image description here

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); } 

demo


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -