HI GUYS, i want this input field to align in middle of the box............ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> <!-- .barbox { background-color:#666666; height: 50px; width: 200px; margin: auto; } --> </style> </head> <body> <div class="barbox"> <input type="text" name="search" value="Search..." style="vertical-align:middle;" /> </div> </body> </html>
Just add text-align: center; to your .barbox sylesheet. I'mm sure there's a better way to get it vertically aligned but adding a padding-top: 12px; and reducing the height to height: 38px; will work, but might have problems in IE6
good gazu but it was just the pixel adjustment mathematically there's ain't other way of getting it perfectly in the middle?
use a table with 2 columns and in one column you put something of 50px height and in the second you add the input box ... it will align vertically ...