This is simple CSS problem I’m sure, but it has stumped me.
If I have a input (textbox) and button, both set to 60% width, the button comes out slightly narrower in width than the textbox (I’m using FF 3.6). Why is this? Can I compensate for it with padding / margins?
The input button use the broken box model where padding and borders are included on the inside on the dimension (don’t ask me why). You would need to account for these if you want them to be the same size which will be quite awkward in a percentage width scenario. Try adding more padding to the button to compensate.
Adding padding or margins didnt affect the overall width of the button as (like you said) as I added more, everything just got pushed further inside the edges of the button.
So, I’ve set my -
Text Input - 60% Width
Button - 61% Width,
And they now line up nicely. Is this the correct / best way?