CSS를 통해 다음을 달성하려고합니다.
이 라인은 상위 div 내부의 모든 div 컨테이너에 연결됩니다.
HTML :
<div class="parent">
<div class="dynamic">
some content some content some content
some content some contentsome content
some content some content some content
</div>
<div class="dynamic">
other some content other some content other some content
othersome content other some contentsome content
other some content other some content some content
</div>
<div class="child3">
Add more content
</div>
</div>
CSS :
.parent {
border-left: 1px solid #ff0000;
}
.dynamic .child3 {
margin-left: 20px;
background: #e9e9e9;
margin-bottom: 10px;
padding: 10px;
}
이것은 내가 지금까지 가지고있는 것입니다 : https://jsfiddle.net/z6nget91/
그러나 모든 컨테이너에 연결하는 줄을 어떻게 추가 할 수 있는지에 대해 고민하고 있습니까? 어떤 아이디어 ?? 감사
::before
이를 달성하기 위해 어린이의 의사 요소를 사용할 수 있습니다 . 다음과 같이 시작할 수 있습니다.
.parent {
border-left: 1px solid #ff0000;
}
.child {
position: relative;
margin-left: 20px;
background: #e9e9e9;
margin-bottom: 10px;
padding: 10px;
}
.child::before {
position: absolute;
content: '';
left: -20px;
top: 50%;
border-top: 1px solid #ff0000;
width: 20px;
}
.child:last-child::after {
position: absolute;
content: '';
left: -21px;
top: calc(50% + 1px);
bottom: 0;
border-left: 1px solid #FFFFFF;
}
<div class="parent">
<div class="child">
some content some content some content
some content some contentsome content
some content some content some content
</div>
<div class="child">
other some content other some content other some content
othersome content other some contentsome content
other some content other some content some content
</div>
<div class="child">
Add more content
</div>
</div>
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다