html - 跨浏览器 - CSS 填充问题

标签 html css google-chrome firefox cross-browser

我正在尝试在输入字段后制作一个验证框,但是,在不同的浏览器中,尺寸会出错,例如firefox 和 chrome 之间有很大的区别。

是否有更好的方法来制作此框,以便在所有浏览器中大小相同?这是我目前如何做的代码和 jsfiddle:http://jsfiddle.net/wPS7t/

这是问题的图片:

HTML

    <form id="formStyles">

        <div id="inputWrapper">
            <input type="text"/>
            <label id="xlabel">x</label>
        </div>                         

    </form>

CSS

        body{
            margin: 0;
            padding: 0;
            height: 100%;
            width: 100%;
            font-family: Calibri;
        }

        *, *:before, *:after {
            -moz-box-sizing: border-box; 
            -webkit-box-sizing: border-box; 
            box-sizing: border-box;
        }

        #formStyles{
            width: 800px;
            margin: 0 auto;
            top: 200px;
            position: relative;
        }

        input{
            font-size: 18px;
            padding: 5px;
        }

        #inputWrapper{
            position: relative;
            margin-left:auto;
            margin-right:auto;
            width:400px;
        }

        #xlabel{
            background-color: red;
            padding: 7.2px;
            color: white;
            left: -6px;
            position: relative;
            top:-1px;

        }

最佳答案

也许尝试填充 7px?我不是很肯定,但我不认为除了 7.2px 之外的两种浏览器结果可能是四舍五入。

关于html - 跨浏览器 - CSS 填充问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21610095/

相关文章:

javascript - 防止页面滚动但允许溢出滚动的元素滚动JQM

php - Bootstrap 3 动态轮播不滑动

html - 将 CSS 选择器限制为最近的父级

html - 如何使用 font-face 缩小 CSS

overflow hidden 的 CSS 问题

html - 在 Chrome 和 Safari 中使用 thead 的双边框间距

css - 是否可以只针对 Chrome,而不是所有支持 Webkit 的浏览器?

php - 如何检测损坏的图像并替换为另一个图像?

jquery - 在 div 中卡住表 Bootstrap header

css - Chrome 中的 SVG 填充神器