I want to put my company logo and text side by side using simple HTML. I dont want to use flexbox. I tried this in order to achieve it :
<table style="background-color: cadetblue;width:100%;padding:10px">
<tr>
<td rowspan="3">
<img src="logo.png" height="80" width="80" />
</td>
</tr>
<tr>
<td class="name1">This is some text</td>
</tr>
<tr>
<td class="name2">This is some text1</td>
</tr>
</table>
This is what I see with above HTML:
This is the style sheet:
<style>
.name1 {
font-size: 25px;
color: #e9c46a;
}
.name2 {
font-size: 25px;
color: white;
}
</style>
Everything looks good except, I want to reduce the space between logo and text. How can I do that. I cannot use flexbox.
3
Answers
To specify where content should be display in your td
You can use attributed valign and align
for example like
valign determine vertical position
and
align determine horizontal position
You could try using the
translateX
CSS Property:Here I added the class
logo
to the image so I can apply the CSS property to it.Check this w3schools page that explains 2d transforms.
Link to Can I use
You can simply add a
width="80"
HTML attribute to the leftmosttd
you have so the size of thetd
will fit the size of the logoimg
.