我可以在css中设置相对于另一个元素的位置吗?

时间:2016-11-27 07:46:15

标签: html css

我想根据100px小于100%的页面设置以下div的底部。我能这样做吗(以下代码不起作用)



div{
  position:absolute;
  height: 50px;
  width:50px;
  background-color:#000000;
  left:40px;
  BOTTOM:100% - 100PX;
  }

<div></div>
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:1)

您可能正在寻找:

bottom: calc(100vh - 100px);

答案 1 :(得分:0)

我想你可以这样做:

CustomerRepository
div{
  position:absolute;
  height: 50px;
  width:50px;
  background-color:#000000;
  left:40px;
  bottom: 100px;

  }

相关问题