who decided the width: textbox with percentage width inside table

Discussion in 'Internet Explorer' started by Zero Wang, Mar 13, 2007.

  1. Zero Wang

    Zero Wang Guest

    for easy formatting my form elements i put textboxes(<input/>) in a table.
    everything goes fine untill i change the text width related to the table cell
    width with percentage width.
    the problem is when the text content in the text box is wider than the
    textbox width, textbox with percentage width in a table will extend to size
    that display (percent)*text content. i'll explain this further with an
    example. and this happens in IE 6 nad 7.
    anyone have any idea why it behaves like this and who should decide the
    textbox width in this situation? this make me pull half of my hair off~~~
    ==========
    == Example
    ==========

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Input Width</title>
    </head>
    <body>
    <div style="height:200px; width:40%; background-color:#8cc; color:#000;">

    <div style="padding-left:10px; padding-right:10px;"><input
    style="width:90%;" value="long text wider than textbox but does not affact
    textbox width in IE. 1234567890 2234567890 3234567890 4234567890 5234567890
    6234567890"/></div>
    <div style="padding-left:10px; padding-right:10px;"><input
    style="width:90%;"/></div>

    <table cellpadding="0" cellspacing="0" border="0" style="width:100%;">
    <tr><td style="padding-left:10px; padding-right:10px;"><input
    style="width:90%;" value="long text wider than textbox that does affact
    textbox width in IE. 1234567890 2234567890 3234567890 4234567890 5234567890
    6234567890"/></td></tr>
    <tr><td style="padding-left:10px; padding-right:10px;"><input
    style="width:90%;"/></td></tr>
    </table>

    </div>
    </body>
    </html>
     
    Zero Wang, Mar 13, 2007
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.