views:

340

answers:

1

Why is there a one pixel gap created between the top and the bottom of the p tag in the following code in IE6 and IE7 but not in Firefox or IE8? I have been pulling my hair trying to create the search texbox on powerset website and interesting enough they don't have the bug in IE6 or IE7. What am I doing wrong?

  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
    <html xmlns="http://www.w3.org/1999/xhtml"&gt;
    <head>
        <title></title>
        <style type="text/css">
            #sbox
            {
                overflow: hidden;
            }
            #sbox p
            {
                /*border:1px solid #dae7fa; */
                float:left;
                display: block;
                border: 1px solid red;
                width: 208px;
                padding: 0;
            }
            input#q
            {
                font-size: 11px;
                padding: 3px;
                border: 1px solid blue;
                width: 200px;
                color: #999999;
            }
        </style>
    </head>
    <body>
        <div id="sbox">
            <p>
                <input id="q" type="text" value="Search..." />
            </p>
        </div>
    </body>
    </html>
A: 

Add float:left; to input#q. That will get collapse p and get rid of the gap.

Emily
arrrghh! thanks a bunch!
zaladane