CSS Max-Width in IE8

后端 未结 2 1177
萌比男神i
萌比男神i 2021-02-13 05:28

For my input, which can either have classname=\"half\" or \"half.not-placeholder-value\", Firebug shows both inputs to have a set, fixed width of

相关标签:
2条回答
  • 2021-02-13 05:58

    This is not really an IE8 issue since IE8 does support the max-width attribute but only when given a defined width first.

    input.half, input.half.not-placeholder-value {
        width: 100%;
        max-width: 25em;
    }
    
    0 讨论(0)
  • 2021-02-13 06:04

    Use IE8 css with width? First part targets IE, second part undoes it for IE9+.

    input.half, input.half.not-placeholder-value {
        max-width: 25em;
        width:25em\9; /* IE 8 */
    }
    :root input.half, input.half.not-placeholder-value {
        width:inherit\9; /* IE 9+ */
    }
    
    0 讨论(0)
提交回复
热议问题