css - 显示 : table-cell problems in chrome

标签 css google-chrome

我有 3 个 div,我想将其显示为表格单元格:

<div class="field">
    <div class="row">
        <label for="name">Subdomain</label>
        <input type="text" id="name" name="name">
        <div class="subdomain-base ">test</div>
    </div>
</div>

这是我正在使用的 CSS:

body{
    font-size: 13px;
}

.field {
    width:450px;
    display: table;
}
.row {
    display: table-row;
    width: 100%;
}
.row > * {
    display: table-cell;
    border: 1px solid red;
}
label {
    width: 125px;
    height: 18px;
}
input {
    max-width: none;
    min-width: 0;
    overflow: auto;
    height: 18px;
    width: 100%;
}
.subdomain-base {
    height: 18px;
    width: 1px;
}
.subdomain-base {
    color: blue;
    font-size: 13px;
}

它在 Firefox 24 中完美运行: enter image description here

但是,它在 Chrome 30(最新)中存在高度问题: enter image description here

我一直在尝试各种方法来解决 Chrome 的问题,但似乎没有任何效果。为什么 chrome 会获得额外的高度?

Jsfiddle:http://jsfiddle.net/ahLMH/

最佳答案

设置这个:

.row > * {
  display: table-cell;
  border: 1px solid red;
  vertical-align: top; // add this
}

Updated Fiddle

关于css - 显示 : table-cell problems in chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19614408/

相关文章:

html - 我需要有关在导航栏(HTML 和 CSS)中定位登录表单的帮助

html - 侧边栏菜单没有延伸到页面底部(CSS 让我抓狂……)

css - 将元素从一个目录复制到另一个目录 - YII2基础

css - 如何在 Angular 中使用 CSS 设置 FontAwesome 图标的大小?

google-chrome - UI5 TileContainer 在 Chrome 中是空白的

javascript - 将图像嵌入到 Chrome 扩展程序中

javascript - 如何从数据库中的字段制作饼图?

java - Chrome 扩展程序与 Java 应用程序交互

javascript - 强制重新加载所有页面资源,而不是从缓存中加载

javascript - 使 Chrome 内容脚本的 'matches' URL 可配置