I have the following HTML
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'> <html xmlns='http://www.w3.org/1999/xhtml' > <head runat='server'> <style> .box { border: solid black 1px; padding: 0px; margin: 0px; } </style> </head> <body> <form id='form1' runat='server'> <input class='box' style='width:300px;' /><br /><!--CRLF for clarity only--> <input class='box' style='width:150px;' /><!--CRLF for clarity only--> <input class='box' style='width:150px;' /><!--CRLF for clarity only--> </form> </body> </html>
When rendered the 2nd row of textboxes appear to be cumulatively longer than the 1 on the first row. This despite explicit setting of widths via the style attribute
Why does this happen and can I avoid it?
Note: This appears to work the same in both FF3 and IE7
jhunter is correct, and I would add that you need Firebug for FireFox (it’s free). You could have figured this out yourself quickly with that installed. Inspect the element you are interested in and look at the ‘layout’ tab.