hello friends can i set float:left
with the margin:auto
this is my html code
<div class='gallary'>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</div>
my css code this is not working.
.gallary{
width:100%;
}
.gallary div{
float:left;
margin:0 auto;
}
please help. Thank you.
just use inline-block instead of float
.gallary div {
display: inline-block;
margin: 0 auto;
}
try this is very help fully. i hop this is used full for you.
.gallary{
width:100%;
}
.gallary div{
vertical-align:top;
display:inline-block;
margin:0 auto;
}
Try using display: inline-block;
to maintain the divs at the same line and text-align:center;
do align to the center:
Here's the fix: http://jsfiddle.net/4xxvb/3/
I tested it and got it working, all you have to do is:
.gallary{
width: 100%;
text-align: Center;
}
.gallary div{
display: Inline-block;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.