我想創建一個垂直的時間軸與其中的一些圖標。 我用this作爲我的出發點。我不知何故設法在div內額外跨度。垂直時間軸與CSS
但它看起來有點亂。因爲我使用白色背景來隱藏線條,並使用額外的跨度來添加圖像。
你能不能審查我的代碼,並幫助我添加一個基於li
致謝id
或class
不同的圖像。 總體而言,我想實現 1.添加基於類別或ID的圖像 2.刪除任何不必要的span
img
標籤以清除代碼。
段:
body{
line-height:1.3em;
}
.history-tl-container{
font-family: "Roboto",sans-serif;
width:50%;
margin:auto;
display:block;
position:relative;
}
.history-tl-container ul.tl{
margin:20px 0;
padding:0;
display:inline-block;
}
span.check {
width: 24px;
height: 24px;
background-repeat: no-repeat;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABGdBTUEAALGPC/xhBQAAAnFJREFUSA3tU01oE0EUnpndVBKjNGkKelLpxYOg4MlSEW9RqCVZEMEfFFEP/mDQ2lSK4Ck/RCh40YseBEHtbmovXuoPeO3Jiz/0okKFStJqBUmyO883WyZMdjdtSb3pHObN+74335uZ94aQ/2OVF6Cr8Gumq8ND+6mmZVAw7AB/2FOYfCo2/5UElWwqqRE2hWoheSIgcCqWsx4xCXRqF68P7kDxx6q4qwU0I+y6EnzN7AtDqMtC8ZjvgBQS604Q3bD1Pr7xHp+4AIC8FkYXUyejmjUuUUpOBu4FqPC6Mya4jopcGRnq16j+xvfuQhGIg3OyO29OC7d5g+83jmzSmW4AwEanRq3eceubCPCO+eHDWxjTJhBvdowaw4GMxQvL4gJ3bzB3bTAR6Qq9RXenAIGQX4TzE7FC+bnw5Zg5vzfUF9/2ilI6IDHV4j4rljMNFXO7KBLSr0pxQWLWKKXMrI6kL6jBffHtpXbieKwPttM4rcaLtZsACNvtJTCLxhi9tzCaui24ajZ1HIt6xReHAD7rku1Aurc4teTll2sA/BOhwV+CEnZrcdTYhT8z6d0sfUromUTRei991bqqdo2W8BjzKuFZp1Ek4sFclxMoYseYQZzA3ASiY+wGPYCn/NwuMAjHor6cnrVuBnESa75L4o6JRbL7cdM7Sa5kAciX3/X6saPP3L5vG+q2qcpWLh/azKLhSXySgyresgaoNbg9gEWdacEDnOYNJNdz98XPudmPSazJE4n5LCcX1yIu9vluoIhRbNEJ7KK0gmFP8gfd+fLZFmwFx3cDJRZiubKBX7+AX3sBe/0H57w0ni+fU2L+geUfUZTBZo5OpcoAAAAASUVORK5CYII=);
background-repeat: no-repeat;
left: -14px;
position: absolute;
padding: 20px;
}
.history-tl-container ul.tl li{
list-style: none;
margin:auto;
margin-left:200px;
min-height:50px;
border-left:1px solid #86D6FF;
padding:0 0 50px 30px;
position:relative;
}
.history-tl-container ul.tl li:first-child:before{
\t background: rgba(138, 223, 199, 1) none repeat scroll 0 0;
}
.history-tl-container ul.tl li:last-child{ border-left:0;}
.history-tl-container ul.tl li::before{
background: #FFFFFF none repeat scroll 0 0;
border: 2px solid rgba(138, 223, 199, 0.74);
border-radius: 500%;
content: " ";
height: 30px;
left: -18px;
position: absolute;
top: -5px;
transition: all 500ms ease-in-out 0s;
width: 30px;
}
/* .history-tl-container ul.tl li:hover::before{
border-color: #258CC7;
transition: all 1000ms ease-in-out;
} */
ul.tl li .item-title{
}
ul.tl li .item-detail{
color:rgba(0,0,0,0.5);
font-size:12px;
}
ul.tl li .timestamp{
color: #8D8D8D;
position: absolute;
width:100px;
left: -50%;
text-align: right;
font-size: 12px;
}
<div class="history-tl-container">
<ul class="tl">
<li class="tl-item" ng-repeat="item in retailer_history">
<span class="check"></span>
<div class="timestamp">
3rd March 2015<br> 7:00 PM
</div>
<div class="item-title">Start from Shire</div>
<div class="item-detail">Don't forget the ring</div>
</li>
<li class="tl-item" ng-repeat="item in retailer_history">
<div class="timestamp">
19th March 2015<br> 3:00 PM
</div>
<div class="item-title">Kill some Orcs</div>
<div class="item-detail">Don't enter the caves!!</div>
</li>
<li class="tl-item" ng-repeat="item in retailer_history">
<div class="timestamp">
1st June 2015<br> 7:00 PM
</div>
<div class="item-title">Throw that goddamn ring in the lava</div>
<div class="item-detail">Also, throw that Gollum too</div>
</li>
</ul>
</div>
那你到底想要達到什麼目的?在我看來很好。 –
我想添加圖像沒有額外的跨度。由於我不擅長CSS和HTML,我會非常感激良好的批評。謝謝。 – Meanteacher
可以有額外的跨度。 –