I've read numerous pages both here and online about how to get text and images to centre vertically, but I just don't seem to be able to manage it. Clearly there is something that I am missing, but what?
tr:nth-child(odd) {
background-color: #FFF;
}
tr:nth-child(even) {
background-color: #FFF4E3;
}
#serviceList {
background-color: #FFDEA5;
border: 2px double white;
margin-bottom: 10px;
}
.serviceContentMode {
float: left;
margin: 2px;
width: 70px;
}
.serviceContentNum {
float: left;
margin: 2px;
font-size: 20pt;
width: 75px;
}
.serviceContentOp,
.serviceContentDesc {
font-size: 12pt;
line-height: 150%;
}
.serviceContentOp {
font-weight: bold;
}
.serviceContentDesc {
font-style: italic;
}
<div id="serviceList">
<h1>Services</h1>
<h3>The following services operate in Southend-on-sea:</h3>
<table width="100%" border="0">
<tbody>
<tr>
<td>
<div class="serviceContentMode"><img alt="Wheelchair-accessible bus" src="http://www.travelinesoutheast.org.uk/se/images/means/WheelchairBus.gif" /></div>
<div class="serviceContentNum"><span style="vertical-align:middle;">1</div></span>
<div class="serviceContentOp">Arriva (in Herts and Essex)</div>
<div class="serviceContentDesc">Southend - Hadleigh - South Benfleet - Thundersley - Rayleigh</div>
</td>
</tr>
<tr>
<td>
<div class="serviceContentMode"><img alt="Wheelchair-accessible bus" src="http://www.travelinesoutheast.org.uk/se/images/means/WheelchairBus.gif" /></div>
<div class="serviceContentNum"><span style="vertical-align:middle;">28</div></span>
<div class="serviceContentOp">First in Essex</div>
<div class="serviceContentDesc">Southend - Hadleigh - Thundersley - Benfleet - Pitsea - Basildon</div>
</td>
</tr>
<tr>
<td>
<div class="serviceContentMode"><img alt="Wheelchair-accessible coach" src="http://www.travelinesoutheast.org.uk/se/images/means/Coach.gif">
</div>
<div class="serviceContentNum"><span style="vertical-align:middle;">X5</span></div>
<div class="serviceContentOp">First in Essex</div>
<div class="serviceContentDesc">Southend - Southend Airport - Rayleigh - Chelmsford - Barnston - Stansted Airport</div>
</td>
</tr>
</tbody>
</table>
</div>
I know that the vertical-align: middle
is currently only applied to the <span>
on the service number in the HTML file, rather than in the CSS, but I've tried all sorts of different combinations all to no avail.
So what am I missing?
Thanks