简体   繁体   English

相对div内的绝对div宽度

[英]Absolute div width inside relative div

I am having problem with html/css. 我有html / css的问题。

  1. I have a container ( position: relative; ) , in my case it is div.jtk-demo-canvas 我有一个容器( position: relative; ),在我的例子中是div.jtk-demo-canvas
  2. Container has floating divs ( position: absolute; ) inside, in my case these are div.jtk-window Container里面有浮动的div( position: absolute; ),在我的例子中这些是div.jtk-window
  3. floating divs should have ( position: absolute; ) as it is requirement for js plugin 浮动div应该具有( position: absolute; ),因为它是js插件的要求

Requirement: Floating divs should have min-width of 200 and max-width of 400. I dont want to apply width to it as it should vary between 200-400 to fit its content. 要求:浮动div应该具有最小宽度200和最大宽度400.我不想应用宽度,因为它应该在200-400之间变化以适合其内容。

But as You can see in my case last div from right is same as 2nd one but its width is lesser. 但正如你可以看到,在我的情况下,右边的最后一个div与第二个相同但宽度较小。

How can I Fix this ? 我怎样才能解决这个问题 ?

jsfiddle: https://jsfiddle.net/bababalcksheep/wm94sf2b/ Since I have large html code, therefore I am posting fiddle link. jsfiddle: https ://jsfiddle.net/bababalcksheep/wm94sf2b/由于我有大量的HTML代码,因此我发布了小提琴链接。

在此输入图像描述

because you gave him left:800px; 因为你给了他left:800px; and your body is width: 960px; 你的身体width: 960px; for that your 3rd div only have 160px place 因为你的第3个div只有160px的位置

Try display: inline-table and position: relative to div with id 117a13213-102 (Checked in Chrome and Firefox ) 尝试display: inline-tableposition: relative对于ID为117a13213-102的 div(在ChromeFirefox中检查)

FIDDLE 小提琴

CODE

<div style="left: 800px; top: 105px; display: inline-table; position: relative;" id="117a13213-102" class="flowBox jtk-window">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM