Try the following simple example:
<html>
<head>
<style>
div,
input {
border: 1px solid #000;
margin: 2px;
padding: 3px;
width: 100px;
}
</style>
</head>
<body>
<div>div</div>
<input value="input" />
</body>
</html>
Notice the div and the input gets different widths. In fact, the width of the input is 92px. For the input, Firefox calculates the width outside the border and padding, the same way IE does for everything. Shouldn't it treat input elements the same as everything else, and add the padding and border to the width?
As phihag says, it's block vs inline.
However, a flaw with your example: you're not using a DOCTYPE.
That means the browser is free to render as it sees fit.
Stick <!DOCTYPE html> at the top to use the nice and compact HTML5 DOCTYPE, which will prevent browsers from going into Quirks Mode.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With