css - p标签和输入标签之间有一个像素的差距

标签 css internet-explorer-6 internet-explorer-7

为什么在 IE6 和 IE7 中的以下代码中 p 标签的顶部和底部之间有一个像素的间隙,而在 Firefox 或 IE8 中却没有? 我一直在努力尝试在 powerset website 上创建搜索文本框 有趣的是,他们没有 IE6 或 IE7 中的错误。我做错了什么?

  <!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>
        <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>

最佳答案

float:left; 添加到输入#q。这将导致崩溃 p 并消除差距。

关于css - p标签和输入标签之间有一个像素的差距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/983529/

相关文章:

jquery - IE7 在 jQuery Slider 中堆叠左浮动 div

asp.net-mvc - HTML 页面布局在 IE7 中看起来不错,但在 IE6 中却不行

javascript - 基于 iframe 的 IE6 javascript 内存泄漏?

javascript - 去除浏览器的标题栏、菜单栏、导航栏、标签栏、地址栏和状态栏

html - 尝试向导航栏添加新元素并向网站添加新页面[找不到错误]

css - IE6 不呈现 div 背景

html - IE7-DIV 不采用溢出 :auto; 的父 DIV 属性的问题

CSS 下拉菜单不适用于 IE7

html - 使用 CSS 我应该使用 p 标签来包装文本还是 div 就足够了?

html - Mozilla Firefox ESR(最新 17)不会显示我的站点菜单,在所有其他浏览器中都可以使用