0

http://codepen.io/anon/pen/gubrp

在上面的链接中,可以注意到元素的大小是固定的,当一行变大时,会发生以下情况

在此处输入图像描述

我想要的是 css 是动态的,就像它在下面的 JSfiddle 上一样(框和线)。我需要进行哪些修改才能使所有框和线变为动态而不是固定大小/固定位置?请注意,框和行都需要更改。

http://jsfiddle.net/bZGFA/40/

下面是第一个示例中的 css 代码。

.root {
  position: relative;
}

.level {
  margin-left: 240px;
  position: relative;
}
.level:before {
  content: "";
  width: 50px;
  border-top: 2px solid #eee9dc;
  position: absolute;
  left: -98px; /*These fixed numbers are the problem but don't know how to solve it*/
  top: 50%;
  margin-top: 1px;
}

.item {
  min-height: 50px;
  position: relative;
}
.item:before {
  content: "";
  height: 100%;
  border-left: 2px solid #eee9dc;
  position: absolute;
  left: -48px; /*These fixed numbers are the problem but don't know how to solve it*/
}
.item:after {
  content: "";
  width: 46px;
  border-top: 2px solid #eee9dc;
  position: absolute;
  left: -46px; /*These fixed numbers are the problem but don't know how to solve it*/
  top: 50%;
  margin-top: 1px;
}

.item:first-child:before {
  width: 10px;
  height: 50%;
  top: 50%;
  margin-top: 2px;
  border-top-left-radius: 10px;
}
.item:first-child:after {
  height: 10px;
  border-top-left-radius: 10px;
}

.item:last-child:before {
  width: 10px;
  height: 50%;
  border-bottom-left-radius: 10px;
}
.item:last-child:after {
  height: 10px;
  border-top: none;
  border-bottom: 2px solid #eee9dc;
  border-bottom-left-radius: 10px;
  margin-top: -11px;
}

.title {
  width: 120px;
  padding: 5px 10px;
  line-height: 20px;
  text-align: center;
  border: 2px solid #eee9dc;
  border-radius: 5px;
  display: block;
  position: absolute;
  left: 0;
  top: 50%;
  margin-top: -15px;
}
4

0 回答 0