Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jan 2005
    Thanked 0 Times in 0 Posts

    vertically centering a form field

    EDIT: Figured it out...

    Small problem that is driving me crazy... I have a search field within a table that will not center vertically for some reason... it sits at the very top.
    I've tried valign center, margin-top: Xpx; (which just makes more space around the whole table for some reason, spacer gif, another table row to shove it down a bit.. nothing seems to work. It either sits at the very top or moves down and makes the table larger than it should be "45px height"

    <table width="1000" border="0" cellspacing="0" cellpadding="0">
        <td width="425" height="45" bgcolor="#000000"><img src="imagse/links.gif"></td>
        <td width="65" align="left" bgcolor="#000000"><img src="images/toolbar-search.gif" alt="Search" width="55" height="45"></td>
        <td width="160" align="left" valign="bottom" bgcolor="#000000"><form action="http://www.mysite.com/search" method="get" enctype="application/x-www-form-urlencoded" name="qs" id="qs"><input name="q" type="text" class="field" id="q" value="" size="15" maxlength="255"><input class="btn" name="btn" type="submit" id="btn2" value="Go"></form></td>
        <td width="350" bgcolor="#000000"><div align="right"><img src="images/toolbar-slogan.jpg" width="350" height="45" border="0"></div></td>
    Last edited by a4udi; 03-13-2009 at 02:58 AM. Reason: SOLVED

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Thanked 2,224 Times in 2,211 Posts
    Get rid of the tables and make a semantic-accessible table less layout, to make your lief a lot easier!
    After that, you may control the vertical alignment by setting a suitable line-height to its parent element.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


    Posting Permissions

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