How to get display:table-cell support in IE? any pure javascript or jQuery workaround?

前端 未结 3 1828
庸人自扰
庸人自扰 2020-12-10 22:23

How to get display:table-cell support in IE? I need lightest solution.

相关标签:
3条回答
  • 2020-12-10 22:59

    Probably if you look at the test site, which use display: table-cell in different combinations, you can easier choose the CSS settings which you need?

    0 讨论(0)
  • 2020-12-10 23:04

    No versions of Internet Explorer (including IE8) support the property values "inline-table", "run-in", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-row", or "table-row-group".

    This is the note from w3schools

    I think you should try another way.

    0 讨论(0)
  • 2020-12-10 23:06

    the fastest (but not clean) solution is to wrap your container by a table inside a conditional comment like so

    <!--[if lte IE 7 ]><table><td><![endif]-->
    <div>                   
     <!-- your markup here -->
    </div>
    <!--[if lte IE 7 ]></td></table><![endif]--> 
    

    Could be acceptable for a single page, but definitely to avoid in a large scale

    otherwise you could specify in detail why are you trying to define a display: table-cell. if this is somewhat related to obtain a vertical alignment of text you could take a look to this snippet of code

    http://jsfiddle.net/fcalderan/985e4/

    -- edit (after comment)

    If you wish to obtain a bottom alignment you could also set position : relative to the image container and then position: absolute; bottom: 0; to the image

    -- edit 2 (after comment)

    We are still waiting your code. Anyway the resulting css will be

    #imagecontainer {   /* or whatever image container you have */
      position: relative;
    }
    
    #imagecontainer img {
      position: absolute;
      bottom : 0;
      left: 50%; 
      margin-left:-n/2px; /* where 'n' is width of your image */
    }
    
    0 讨论(0)
提交回复
热议问题