code_junkie

Vertically align text within input field of fixed-height without display: table or padding?

Nov 12th, 2011
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. <div style="line-height: 60px; height: 60px; border: 1px solid black;">
  2. <input type="text" value="foo" />&nbsp;
  3. </div>
  4.  
  5. <input type="text" style="padding-top:8px; padding-bottom:8px; margin: 0; border: solid 1px #000000; font-size:22px;" />
  6.  
  7. .form-text {
  8. color: white;
  9. outline: none;
  10. background-image: url(input_text.png);
  11. border-width: 0px;
  12. padding: 0px 10px 0px 10px;
  13. margin: 0px;
  14. width: 274px;
  15. height: 24px;
  16. line-height: 24px;
  17. vertical-align: middle;
  18. }
  19.  
  20. height : 36px; //for other browsers
  21. line-height: 36px; // for IE
  22.  
  23. #search #searchbox {
  24. height: 21px;
  25. line-height: 21px;
  26. }
  27.  
  28. Vertical-Align: Middle;
Add Comment
Please, Sign In to add comment