html - 在 IE 中选择不在行中的框

标签 html css layout

好吧,我真的不想问这个问题,因为它应该是一个非常简单的解决方案,但我花了几个小时试图解决它,但无济于事。 我有一个带有文本框的网页,然后是彼此相邻的选择下拉菜单。在 Firefox 和 chrome 中,它们并排排列得很好,但在 IE 中,选择框比文本框高。此选择框或文本框没有应用 CSS。

Image

这是一个 aspx 页面,为此生成的 HTML 源是:

<label for="ctl00_main_primaryEmail" id="ctl00_main_primaryEmailLabel">Primary Email: </label>
<input name="ctl00$main$primaryEmail" type="text" id="ctl00_main_primaryEmail" />
<select name="ctl00$main$acceptedDomainsDropDownList" id="ctl00_main_acceptedDomainsDropDownList">
            <option value="domain.com">domain.com</option>
            <option value="doamin1.com">domain1.com</option>
            <option value="domain2.com">domain2.com</option>
            <option value="domain3.com">domain3.com</option>
        </select>

最佳答案

您是否使用任何 CSS 来重置所有标签的边距和填充?用类似这样的东西开始你的样式表是非常有用的:

    *,html {
    margin: 0;
    padding: 0;
    }

这消除了浏览器(即 IE)之间的许多渲染不一致,并且在实际需要的地方提供填充/边距所需的额外 CSS 往往很少。有了这个“重置”规则,框在 IE 中排成一行(6 和 7 已测试),尽管不同默认字体大小的问题仍然存在:

alt text http://www.mikrogroove.com/stackoverflow/textbox_selectbox_alignment.gif

关于html - 在 IE 中选择不在行中的框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/729193/

相关文章:

html - li 和隐藏 div 上的 firefox 中的 css 大纲错误

html - 日期标题重叠帖子标题

html - 如何为 iOS Safari、Mac Safari、Edge 和 IE11 添加背景线性渐变?

layout - 节点之间的 BorderPane 间距

android - ListView 页脚宽度

html - 如何使用 CSS 在一个 div 中使用多个 span 创建表格

javascript - 如何更改 jquery 数据表列的颜色

html - 与流体容器内 Logo 的相对定位

html - 如何使用 HTML/CSS 和 Bootstrap 使视频适合网页的背景?

css - Bootstrap 响应式设计的奇怪行为