/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Image next to a Division

Hi,

How can I put an <img> next to a <div> so the image vertically aligns in the middle?

[CODE]<img src=”http://devcentral.f5.com/weblogs/images/comment-icon.gif”><div style=”font:10pt Arial;padding:5px;background-color:#ccc;”><span style=”float:right”>No. 1</span><span style=”font-weight:bold;padding-right:10px”>John Doe</span><span style=”color:#808080″>11/14/2010 3:23:44</span></div>[/CODE]

I know how to do it using a table:

[CODE]<table style=”font:10pt Arial”>
<tr>
<td style=”vertical-align:middle”><img src=”http://devcentral.f5.com/weblogs/images/comment-icon.gif”></td>
<td style=”width:100%”>
<div style=”padding:5px;background-color:#ccc;border-top:1px solid #DEDEDE”><span style=”float:right”>No. 1</span><span style=”font-weight:bold;padding-right:10px”>John Doe</span><span style=”color:#808080″>11/14/2010 3:23:44</span></div>
</td>
</tr>
</table>[/CODE]

But I wonder if I could do it without a table.

Thanks in advance!
Rain Lover

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@EMaksNov 27.2010 — I've done it like this
[CODE]<img src="http://devcentral.f5.com/weblogs/images/comment-icon.gif" style="float:left; padding-top: 5px;">
<div style="font:10pt Arial;padding:5px;background-color:#ccc; margin-left:20px;">
<span style="float:right">No. 1</span><span style="font-weight:bold;padding-right:10px">John Doe</span><span style="color:#808080">11/14/2010 3:23:44</span></div>[/CODE]
Copy linkTweet thisAlerts:
@Major_PayneNov 28.2010 — Your question has already been answered [B][COLOR="Red"]here[/COLOR][/B].. Might be nice to respond to answer posted.
×

Success!

Help @Rain_Lover spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...