/    Sign up×
Community /Pin to ProfileBookmark

Would like to center this text vertically with respect to image

Please let me know how I can center the following text to the image that is beside it.

[code=html]<div style=”float:left”>
<img src=”http://upload.wikimedia.org/wikipedia/commons/thumb/c/c1/Square-symbol.svg/50px-Square-symbol.svg.png”/> &nbsp;&nbsp;
</div>
Text
<br/>
Text [/code]

(can be tested with [url]http://www.w3schools.com/html/tryit.asp?filename=tryhtml_intro[/url])

to post a comment
CSS

3 Comments(s)

Copy linkTweet thisAlerts:
@mordaukNov 23.2009 — I'm entirely sure what you are asking, but if you want the image and text to be center left-and-right on the page, then all you need to do is remove float: left; from your div style and add margin: 0 auto; instead.
Copy linkTweet thisAlerts:
@mordaukNov 23.2009 — Sorry, after rereading I realized what you were asking.

Put this in your style

div {

line-height:8em;

}

img {

vertical-align:middle;

}

Modify line-height until you are satisfied.
Copy linkTweet thisAlerts:
@M123authorDec 29.2009 — Thanks for the help.

Sorry for the late reply, I ended up using what you suggested in my solution, but forgot to reply...
×

Success!

Help @M123 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.18,
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,
)...