如何将两个div排成一排:一个固定,另一排被拉伸 [英] How to places two divs in one row: one fixed, other is stretched

查看:123
本文介绍了如何将两个div排成一排:一个固定,另一排被拉伸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要两个div框:一个位于左侧,宽度固定,另一个位于first的右侧,它应该伸展到右侧. 该怎么做?

I need two div boxes: one at left side with fixed width, and other on the right side of first and it should stretch to right side. How to do this?

/-- 30px --//------ * -------/
|          |                 |
|          |                 |

推荐答案

最好不要使用绝对位置,因为您可能希望将其放置在其他元素中. 那对我有用:

Better not to use absolute position, since you may want to place it within other elements. That's what works for me:

<div>
  <div style="float: left; width: 30px">1</div>
  <div>2</div>
</div>

这篇关于如何将两个div排成一排:一个固定,另一排被拉伸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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