Page is a not externally linkable
- Code, Content, and Presentation
-- CSS
---- Vertically center text in unordered list


csuguy - 4:13 pm on Aug 16, 2008 (gmt 0)


Other than when using a table - vertical-align only lines things up according to the line-height. OR according to Image Height!

Here's a little technique I developed - adapted for your situation. Put an img tag in each li like so:


<ul class="search_results_rows_even">
<li class="search_year"><img class="valigner">Year</li>
<li class="search_make"><img class="valigner">Make</li>
<li class="search_model"><img class="valigner">Model</li>
<li class="search_price"><img class="valigner">$price</li>
<li class="search_thumbnail"><img src="url"></li>
</ul>

And in your CSS file put this:


.valigner
{
height:100%;
width: 0px;
vertical-align: middle;
visibility: hidden;
}

I tested that in both IE6 and FF2. It should work in all others as well - but test to make sure.


Thread source:: http://www.webmasterworld.com/css/3724488.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com