Reputation: 55
I'm struggling to vertically align text with an image within the same HTML cell that they share. I'm sharing a simpler version of the test html file I created, but in the past I've tried everything from CSS and nested tables but somehow couldn't get it to work. Appreciate the help.
CSS:
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 25%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
</style>
Html:
<table>
<tbody>
<tr>
<th>Col-1</th>
<th>Col-2</th>
</tr>
<tr>
<td><img src="Star.png" style="width:60px"> Static Text</td>
<td>Static Text</td>
</tr>
</tbody>
</table>
Upvotes: 2
Views: 47