I\'m having a problem centering an element that has the attribute position
set to absolute
.
Does anyone know why the images are not centered?
An absolute object inside a relative object is relative to its parent, the problem here is that you need a static width for the container #slideshowWrapper
, and the rest of the solution is like the other users says
body {
text-align: center;
}
#slideshowWrapper {
margin-top: 50px;
text-align:center;
width: 500px;
}
ul#slideshow {
list-style: none;
position: relative;
margin: auto;
}
ul#slideshow li {
position: relative;
left: 50%;
}
ul#slideshow li img {
border: 1px solid #ccc;
padding: 4px;
height: 450px;
}
http://jsfiddle.net/ejRTU/10/