让span填充剩余宽度? [英] Let span fill remaining width?

查看:1338
本文介绍了让span填充剩余宽度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下li项目:

<li>
  <span style='float:left; background-color:red'>a</span>
  <span style='float:left; background-color:green'>b</span>
</li>

我希望右边的span填充它的父li中剩余的任何宽度。有办法吗?

I'd like the span on the right to fill whatever width is remaining in its parent li. Is there a way to do that?

感谢

推荐答案

不想浮动每一个,只剩下第一个,然后让第二个显示在块模式:

You don't want to float each of them left, only the first one, and then make the second one display in block mode:

<li>
  <span style='float:left; background-color:red'>a</span>
  <span style="display: block; background-color:green;">b</span>
</li>

这篇关于让span填充剩余宽度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆