Results 1 to 2 of 2

Thread: vertical align of paragraph to image problem

  1. #1
    Join Date
    Nov 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default vertical align of paragraph to image problem

    dear seniors...

    i need some help in vertical alignment of text. i have one div within which there is
    first one image
    then text (say h1)
    and another image in last.

    i have this kind of css with html:

    <div>
    <img src="1.jpg" style="float:left;"/>
    <p style="float:left;">here goes text which need to be in middle vertically</p>
    <img src="2.jpg" style="float:left;"/>
    <div style="clear:both;">
    </div>
    </div>

    and my images are big in height so it is showing that text are in top with the level of image which i want to be in the middle i.e. vertically in middle.

    plz help me senior, how would i be able to do that? i am sorry for my poor english.. if you dont understand this then plz see picture which i have attached here.

    plz help me.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Does this help?

    Code:
    <div>
    <img src="1.jpg" style="float:left;"/>
    <p>here goes text which need to be in middle vertically</p>
    <img src="2.jpg" style="float:right;"/>
    <div style="clear:both;">
    </div>
    </div>
    What you need is vertical-align:middle; but it is difficult to do.
    This page might help:
    http://www.student.oulu.fi/~laurirai/www/css/middle/
    You can also search google for more information.


    The easiest way I have found to do this is to use a table. In a <td> vertical-align usually works. It's not the best way to make a page, but it's the easiest way that I know to do what you are asking for. Someone else may have a better answer.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •