Wrox Programmer Forums
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 7th, 2004, 09:14 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default Align IMG with text

Ugh, this has been bugging me for days.

I have an image on the left side of a cell, and text after it. I want the text to be aligned in the middle of the image, not the top, not the bottom, the middle. I can't seem to get anything to work.

+----+ This is how it looks
|IMG |
+----+

+----+
|IMG | This is how I want it to look
+----+

Thanks.

----------
---Snib---
----------

<><
__________________
-Snib - http://www.snibworks.com
Where will you be in 100 years?
 
Old April 7th, 2004, 11:10 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Snib,

Did you try align="middle" on the image? e.g.:

<img src="SomeImage.gif" width="200" height="200" align="middle" /> This text will appear in the middle....

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old April 7th, 2004, 11:15 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Imar: Thanks, I'll try it.

----------
---Snib---
----------

<><
 
Old April 7th, 2004, 03:15 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Personally, I'd use CSS to accomplish that.
<img src="images/hands.jpg" style="width: 225px; height: 169px; vertical-align: middle;" />Some text

The align="", width="" and height="" attributes are all deprecated.

: )
Rich

::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::
 
Old April 7th, 2004, 03:16 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

I tried vertical-align: middle; and it didn't work. I've still yet to try Imar's suggestion.

----------
---Snib---
----------

<><
 
Old April 7th, 2004, 03:33 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Uh, it works for me.
Can you post an snippet of mark-up in its natural context?

Are you using a DOCTYPE? And what browser?

: )
Rich

::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::
 
Old April 7th, 2004, 03:51 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Rich, I'm really sorry. I've been applying the suggestions you gave me to the table cell, not the image. I tried how you said it and it worked. Thanks a lot!

FYI: My browser: IE6. I did not use a DOCTYPE.

Thanks again.

----------
---Snib---
----------

<><
 
Old April 7th, 2004, 03:59 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

No worries!

: )
Rich

::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::
 
Old April 7th, 2004, 04:12 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yeah, very true, Rich.

Sorry for posting old and deprecated code. Old habits die hard, although I really try..... ;)

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old April 7th, 2004, 04:25 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

I personally use this type of depreciated code a lot.... Do all browsers support it (I only own IE6)?

----------
---Snib---
----------

<><





Similar Threads
Thread Thread Starter Forum Replies Last Post
IMG Displays but text field is not displayed. shoakat ASP.NET 2.0 Professional 2 June 25th, 2007 06:04 AM
CSS Text Align webnitro CSS Cascading Style Sheets 3 December 8th, 2005 01:19 PM
Align text in textarea crmpicco HTML Code Clinic 27 June 14th, 2005 08:26 AM
Align text acko ASP.NET 1.x and 2.0 Application Design 2 January 9th, 2004 10:21 AM
Right align text in labels in a templatecolumn texasraven ASP.NET 1.x and 2.0 Application Design 1 August 27th, 2003 08:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.