0

当在这 3 个差异中看到时,表单中文本字段的垂直位置怎么可能有 3 px 的差异。浏览器?

我要疯了。尝试在 CSS 中修复它是不好的,因为如果我更改它,它在一个中很好,但在其他中则不行。

#pricefromR 

{width:75px;
position:relative;
right:40px;
top: 50px;
}

#pricetoR 

{width:75px;
position:relative;
right:-45px;
top: 24px;
}

因此,这对应于两个应该是平行的 texfields,彼此处于相同的水平,但它们不在不同的浏览器中,相差 3 px,并且它与每个在 LI 中的其他对发生相同

<li>
        <input type ="text" id = "areafromR" placeholder="area from" name = "areafrom" maxlength = "5">&nbsp;
        <input type ="text" id = "areatoR" placeholder="area to" name = "areato" maxlength = "5">
    </li>
4

2 回答 2

0

所有浏览器都不同,它们有不同的默认值,以及不同的 wu=idths/heights。我所知道的最好的方法是使用百分比,但这可能会变得复杂。您可以为不同的浏览器制作单独的 CSS。例如......那是针对Internet Explorer的

于 2012-11-12T13:53:26.657 回答
-2

您应该尝试重置您的 CSS

如果您不知道,每个浏览器都有自己的默认“用户代理”样式表,它用于使无样式的网站看起来更清晰。例如,大多数浏览器默认将链接设为蓝色,将访问链接设为紫色,为表格提供一定数量的边框和填充,对 H1、H2、H3 等应用可变字体大小,并为几乎所有内容设置一定数量的填充。有没有想过为什么提交按钮在每个浏览器中看起来都不一样?它限制了浏览器之间的差异

使用 CSS 重置,您可以强制每个浏览器将其所有样式重置为 null,从而减少跨浏览器差异

使用此代码:

/**
* Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)
* http://cssreset.com
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}

一种常见的做法是将其放在另一个 CSS 文件中。

于 2012-11-12T13:53:27.920 回答