学无先后,达者为师

网站首页 编程语言 正文

css实现左边div固定宽度,右边div自适应撑满剩下的宽度

作者:想做大熊猫饲养员 更新时间: 2022-04-11 编程语言

1.使用float

.use-float>div:first-child{ width:100px; float:left; } .use-float>div:last-child{ overflow:hidden; }

2.使用table

.use-table{ border-collapse:collapse; width:100%; } .use-table>tbody>tr>td:first-child{ width:100px; }

3.使用div模拟table 

.use-mock-table{ display:table; width:100%; } .use-mock-table>div{ display:table-cell; } .use-mock-table>div:first-child{ width:100px; }

4.使用flex

.use-flex{ display:flex; } .use-flex>div:first-child{ flex:none; width:100px; } .use-flex>div:last-child{ flex:1; }

 

原文链接:https://blog.csdn.net/qq_38397397/article/details/90182600

栏目分类
最近更新