I have this markup

<div id="line" width="100%; height: 44px;">
   <div id="identifier" style="position: absolute;left:0px width: 90px;">blabla</div>
   <div id="title" style="position: absolute; left: 90px;float: left; display:inline;">title</div>
   <div id="button" style="width:100px;float:right">gfgh</div>
</div>

How can I stretch div[id='title'] so it fills all the remainder space until next div (button)?

有帮助吗?

解决方案

  • Set position:relative on div#line.
  • Set right:100px on div#title.

其他提示

You could try changing its CSS to this:

position: absolute; left: 90px; right: 100px; width: auto;

You will have to add position:relative to #line for this to work reliably (e.g. if #line changes its width in future).

Also note that this might not work reliably in older versions of IE, but it should work in theory.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top