Display: table-cell problems in chrome

后端 未结 3 1572
时光取名叫无心
时光取名叫无心 2021-01-14 00:24

I have 3 divs that I would like to display as table cells:

3条回答
  •  离开以前
    2021-01-14 00:51

    The problem appears to be due to display: table-cell on input elements being experimental. See this question for more details: display:table-cell not working on an input element

    The solution is to wrap the input in a span and apply display: table-cell to the span and to remove overflow: auto from the input.

    The new mark up looks like so:

    test

    The css now looks like this:

    body {
        font-size: 13px;
    }
    .field {
        width:450px;
        display: table;
    }
    .field > * {
        display: table-cell;
        border: 1px solid red;
    }
    span {
        padding: 0 5px;
    }
    label {
        width: 125px;
    }
    input {
        width: 100%;
    }
    .subdomain-base {
        width: 1px;
    }
    .subdomain-base {
        color: blue;
        font-size: 13px;
    }
    

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

提交回复
热议问题