I am facing a challenge with styling form elements precisely, and it's causing me frustration.
When I attempt to remove padding, margin, border, and outline from an input element (with display: block) so that its size is solely determined by the text within, the input field ends up with slightly more padding than other block-level elements styled in the same way. Here's an example: http://jsfiddle.net/nottrobin/b9zfa/
<input class="normalised testSubject" value="hello" />
<div class="normalised testSubject">hello</div>
When rendered:
In this example, the div has a computed height of 16px while the input has a computed height of 19px.
I've observed this behavior in Chrome 16, Firefox 9, and Opera 11, indicating it's consistent across rendering engines.
I can resolve the issue by manually setting a height, but I prefer not to as I want the design to remain responsive.
Could someone help me understand why this is happening and how I can ensure the input will have the same height as any block-level element following it?