2017-10-18 56 views

回答

0

你可以有點瘋狂,但你可以做到這一點。我不知道我是否會在很多情況下推薦此代碼,因爲它很「微妙」,我懷疑可能很容易中斷。

.time-chart { 
 
    font-family: Arial, sans-serif; 
 
    font-size: 12px; 
 
} 
 

 
h3.start { 
 
    border: 0; 
 
    border-radius: 15px; 
 
    background: blue; 
 
    color: white; 
 
    display: inline-block; 
 
    font-weight: normal; 
 
    font-family: Arial, sans-serif; 
 
    font-size: 12px; 
 
    padding: .75em; 
 
    margin: 0; 
 
    margin-left: 105px; 
 
} 
 

 
ul.timeline { 
 
    padding-left: 170px; 
 
    margin-top: -6px; 
 
} 
 

 
ul.timeline li { 
 
    padding-left: 0; 
 
    margin-bottom: 2.5em; 
 
    list-style: none; 
 
} 
 

 
.event { 
 
    font-size: 1em; 
 
    display: inline-block; 
 
    margin-left: -160px; 
 
    font-weight: bold; 
 
} 
 

 
.event:after { 
 
    content: "•"; 
 
    color: blue; 
 
    background: white; 
 
    border: 1px solid blue; 
 
    width: 10px; 
 
    height: 10px; 
 
    border-radius: 50%; 
 
    position: absolute; 
 
    left: -21px; 
 
    line-height: 12px; 
 
    text-align: center; 
 
    vertical-align: middle; 
 
} 
 

 
.description { 
 
    display: block; 
 
    margin-top: -12px; 
 
    padding-left: 10px; 
 
} 
 

 

 
/* BORDERS AND BULLETS */ 
 

 
p { 
 
    /*CSS reset*/ 
 
    margin-bottom: 0; 
 
} 
 

 
ul.timeline li { 
 
    position: relative; 
 
    /* so that pseudoelements are positioned relatively to their "li"s*/ 
 
    /* use padding-bottom instead of margin-bottom.*/ 
 
    margin-bottom: 0; 
 
    /* This overrides previously specified margin-bottom */ 
 
    padding-bottom: 2.5em; 
 
} 
 

 
ul.timeline li:after { 
 
    /* bullets */ 
 
    content: ""; 
 
} 
 

 
ul.timeline li:before { 
 
    /* lines */ 
 
    content: ""; 
 
    position: absolute; 
 
    left: -16px; 
 
    /* adjust manually */ 
 
    border-left: 1px solid blue; 
 
    height: 100%; 
 
    width: 1px; 
 
} 
 

 
ul.timeline li:first-child:before { 
 
    /* first li's line */ 
 
    top: 6px; 
 
    /* moves the line down so that it disappears under the bullet. Adjust manually */ 
 
} 
 

 
ul.timeline li:last-child:before { 
 
    /* last li's line */ 
 
    height: 6px; 
 
    /* shorten the line so it goes only up to the bullet. Is equal to first-child:before's top */ 
 
}
<div class="time-chart ui-widget"> 
 
    <h3 class="start">Journey Begins</h3> 
 
    <ul class="timeline"> 
 
    <li>&nbsp;</li> 
 
    <li> 
 
     <div class="event">New Product Launch</div> 
 
     <p class="description">Jelly-o pie chocolate cake...</p> 
 
    </li> 
 
    <li class="green"> 
 
     <div class="event">New York Times</div> 
 
     <p class="description">Jelly-o pie chocolate cake...</p> 
 
    </li> 
 
    <li class="green"> 
 
     <div class="event">New York Times</div> 
 
     <p class="description">Jelly-o pie chocolate cake...</p> 
 
    </li> 
 
    <li>&nbsp;</li> 
 
    </ul> 
 
</div>

+0

非常感謝你的兄弟。我來檢查一下。我會讓你知道的。 @Twisty –

+0

該代碼有效!謝謝。你能告訴一件事嗎?我怎樣才能讓子彈變大。並且在它外面的戒指並不完全一致。我該怎麼做? –

+0

@FahmidaKhan你應該更熟悉CSS。它會幫助你。另外,你可以看看'.event:after'屬性。它繼承了12px的'font-size',你可以將'font-size'定義爲另一個值來增加項目符號的大小,因爲它是文本。如果需要,您還需要調整「寬度」和「高度」。 – Twisty

相關問題