css - Problems with centering in -
I have seen how to get an unordered list center and for many reasons, for some reason I have to work it though Can not get it for What am i doing
HTML:
& lt; Section id = "gallery" & gt; & Lt; Ul & gt; & Lt; Li style = "background-image: url ('.....');" & Gt; & Lt; / Li & gt; & Lt; Li style = "background-image: url ('.....');" & Gt; & Lt; / Li & gt; & Lt; Li style = "background-image: url ('.....');" & Gt; & Lt; / Li & gt; & Lt; Li style = "background-image: url ('.....');" & Gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Section & gt; CSS:
# Gallery {Text-align: center; } # Gallery ul {display: inline-block; Padding: 0; List style: none; Hidden flurry; } # Gallery ul li {display: block; Background-position: center; Background size: cover; Repeat Background: No Repetition; -max-boundary-radius: 5px; -WebKit-boundary-radius: 5px; Boundary-radius: 5px; -khtml-boundary-radius: 5px; Width: 250px; Height: 250px; Margin: 2.5%; Swim left; } Edit: Screenshots -
I think that Do what you want to do is list the center in the list
First make your UL performance as: Block; Second, remove your float on Li and display them: inline-block;
Text-align you as a gallery: The center will make all inline-block elements self centric and always stand-in-inline-block like I think is set in the basic form.
HTML & lt; Section id = "gallery" & gt; & Lt; Ul & gt; & Lt; Li style = "background-image: url ('.....');" & Gt; & Lt; / Li & gt; & Lt; Li style = "background-image: url ('.....');" & Gt; & Lt; / Li & gt; & Lt; Li style = "background-image: url ('.....');" & Gt; & Lt; / Li & gt; & Lt; Li style = "background-image: url ('.....');" & Gt; & Lt; / Li & gt; & Lt; Li style = "background-image: url ('.....');" & Gt; & Lt; / Li & gt; & Lt; Li style = "background-image: url ('.....');" & Gt; & Lt; / Li & gt; & Lt; / Ul & gt;
CSS # Gallery {text-align: center; Width: 100%; Background: blue; } # Gallery ul {display: block; Padding: 0; List style: none; Hidden flurry; } # Gallery ul li {display: inline-block; Vertical-alignment: top; Background-position: center; Background size: cover; Repeat Background: No Repetition; -max-boundary-radius: 5px; -WebKit-boundary-radius: 5px; Boundary-radius: 5px; -khtml-boundary-radius: 5px; Width: 50px; Height: 50px; Margin: 2.5%; } # Gallery ul li {background color: red; }
Let me know if you have any questions.
Comments
Post a Comment