Why do Firefox and Opera ignore max-width inside of display: table-cell?

后端 未结 9 707
别跟我提以往
别跟我提以往 2020-11-27 13:49

The following code displays correctly in Chrome or IE (the image is 200px wide). In Firefox and Opera the max-width style is ignored completely. Why does this

9条回答
  •  生来不讨喜
    2020-11-27 14:14

    For a specific case, there's another workaround that I accidently found online: if you use display: table; + display: table-cell; to mimic a two (or more) column layout in a responsive site, try this instead: give the sidebar a widht of, say, 350px and the main content part of the site a width like width: calc(100% - 360px); . That did the trick for me, and the bonus was I needed a fixed width sidebar. I giess that will work with em's too.

    Of course, this is js-dependent, but nowadays should be more than OK.

提交回复
热议问题