What is the difference between inline-block and inline-table?

后端 未结 3 1007
深忆病人
深忆病人 2020-12-12 22:13

As far as I can tell, these display selectors seem to be identical.

From the Mozilla CSS documentation:

inline-table: The inline-

3条回答
  •  爱一瞬间的悲伤
    2020-12-12 22:13

    Here are relevant differences in practice. Run the code snippet to see it at first glance.

    • Vertical alignment of surrounding text:
      inline-table elements align with its top cell or top baseline (if content is only multiple lines of text).
      Text around inline-box aligns with its bottom.
    • height works different, e.g. heightis probably not as you expect on
      (see test5 and 6)
    • width and overflow works different,
      e.g. setting width smaller than content, see test7, 8, 9, 10
    • 
      test1
            
             display 
      inline
      block
      test2 display
      inline
      table
      test3
      inline
      block
      test4
      inline
      table
      test5
      inline
      block
      test6
      inline
      table
      -
      test7 block test8 table test9
      inline
      block
      test10
      inline
      table
      test11
      inline
      block
      test12
      inline
      table
      -

提交回复
热议问题