How to make multiple divs display in one line but still retain width?

前端 未结 5 817
野性不改
野性不改 2020-12-04 14:00

Normally, you set elements to display: inline if you want them to display in the same line. However setting an element to inline means that the width attribute would be mean

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-04 14:25

    I used the property

    display: table;
    

    and

    display: table-cell;
    

    to achieve the same.Link to fiddle below shows 3 tables wrapped in divs and these divs are further wrapped in a parent div

    Here is the jsfiddle: http://jsfiddle.net/vikikamath/QU6WP/1/ I thought this might be helpful to someone looking to set divs in same line without using display-inline

提交回复
热议问题