Extend last li to remaining width of a ul?

前端 未结 2 1299
庸人自扰
庸人自扰 2020-12-19 04:41

I have been puzzled about this for a while now. Here is what i have now:

-------------------------------------------------------------------------------
|            


        
2条回答
  •  春和景丽
    2020-12-19 05:16

    ul>li:last-of-type {width:whatever}
    

    So the two li's before the last would float:left and have 20% on both and the last one can have 60%;

    Also don't forgot to clear the flaots with

    ul {overflow:auto;}
    

    and keep the % perfect so the borders do not escape:

    ul>li {box-sizing:border-box;}
    

提交回复
热议问题