如果div符合其他内容,请将div的高度降低

时间:2018-03-24 18:36:57

标签: javascript css

我正在制作一个时间轴,我希望将时间轴上的任何事件表示为旁边有描述的行。但是如果2条线太近而它们的内容发生碰撞,我希望其中一条线更短。这是一个例子:

|note number 1                          |This line is the same height as the
| |this line is lower                   |first one
| |so it doesn't hit the text above it  |
| |                                     |
| |                                     |
| |                                     |

谢谢!

1 个答案:

答案 0 :(得分:0)

快速代码示例。





<div class="upper"></div>

<div class="lower">This is the lower.</div>
&#13;
.lower{
    margin-left:25px;
    background:blue;
}

.upper{
    background:red;
}
&#13;
&#13;
&#13;



&#13;
&#13;
<div class="upper">This is the upper with text.</div>

<div class="lower">This is the lower.</div>
&#13;
link_to_open = listings_df.loc[1:1,'photo_links']
&#13;
&#13;
&#13;