It doesn't look like you're showing all the css in your example (is there a div or two acting as the border?), but have you tried removing the height
attribute and setting the padding-bottom
to padding-top
's value (9px
)?
views:
1153answers:
3
+1
A:
ironsam
2009-07-31 07:47:29
Oops! Yah I'll add that now.
Matt
2009-07-31 07:56:16
I just tried that. Removed padding-top, height, added 9px padding-bottom. It just causes all the text and the cursor to go to the very top.
Matt
2009-07-31 08:02:28
Remove only the `height` and have both `padding-bottom: 9px` and `padding-top: 9px` on the `input#search_input` class.
ironsam
2009-07-31 08:12:54
Okay. Yah I mean the caret moves, but so does the text. Maybe I just need to try a different font. I normally wouldn't care about this sort of thing- but this search is like the main asset of the website.
Matt
2009-07-31 08:30:45
+1
A:
Sidenote: you don't need div#search_icon
, your input could have the following background:
background: white url('images/magnifier.png') no-repeat right NNpx;
Felipe Alsacreations
2009-07-31 09:03:57
+2
A:
Your problem is that you're not taking into account padding on the input box when you're specifying its height.
You're specifying a height of 32px, but any padding gets added to that, so the height of your input box is actually 32 + 9 + 4 = 45px. The cursor is being vertically centered in the 45px tall input box, but your border is around the 32px tall div. Change 'height: 32px' to 'height: 19px' on the search input and it works.
I (very highly) recommend using Firebug. It's very useful for figuring out these sorts of things.
Sam DeFabbia-Kane
2009-07-31 15:08:57