rodolfo navalon
rodolfo navalon

Reputation: 193

Aligning the text inside a <ul> list

How can I align the text inside my ul list?? I tried vertical-align: middle but it didnt work

I there any alternative for it??

Here is the fiddle link: http://jsfiddle.net/TBEnf/1/ Here is my code

<style>
.profilePicture {
    width:200px;
    height:200px;
    border:1px solid #808080;
    margin:5px;

}

.UploadPicture ul li a {
    display:table-cell;
    text-decoration:none;
    margin-left:10px;
    padding-left:30px;
    padding-right:30px;

}
.UploadPicture ul li {
    display:table-cell;
    list-style-type:none;
    margin:10px;
    vertical-align:middle;
    display:block;
    background:#ff6a00;
}
.UploadPicture ul li:hover {
    background:#808080;
}
 .UploadPicture ul {
     display:table-row;
}

   <div class="UploadPicture">
                <ul>
                    <li><a href="#">Change Profile Picture</a></li>
                    <li><a href="#">Privacy</a></li>
                </ul>
            </div>

Upvotes: 0

Views: 71

Answers (1)

Roddy of the Frozen Peas
Roddy of the Frozen Peas

Reputation: 15219

Remove display:table-cell from the a styling. Then text-align:center will work.

.UploadPicture ul li a {
    text-decoration:none;
    margin-left:10px;
    padding-left:30px;
    padding-right:30px;

}
.UploadPicture ul li {
    list-style-type:none;
    margin:10px;
    vertical-align:middle;
    display:block;
    background:#ff6a00;
    text-align: center;
}

Also note that the syntax is text-align: center, not middle.

Updated JSFiddle.

Upvotes: 2

Related Questions