search

Home  >  Q&A  >  body text

css - html表格 td 宽度随着固定为内容宽度

在一个表格td里面放了一个img 因为高度宽度比例不确定,所以只能固定高度,宽度自适应,但是td的宽度始终比img要宽得多,怎么才能让td的宽度就等于img的宽度?

PHP中文网PHP中文网2779 days ago544

reply all(2)I'll reply

  • 巴扎黑

    巴扎黑2017-04-17 11:52:29

    If you want to make td and img have the same width and height, just set the width or height of td, and then insert the width=100% or height=100% of img to make the height or width adaptive, so that img will be You can open the TD.

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 11:52:29

    https://jsfiddle.net/wj6tqvmr/1/

    reply
    0
  • Cancelreply