2017-03-14 48 views
-2

我想要得到這樣的效果頭:如何實現這種邊界風格? CSS只首選

enter image description here

我想沿着元件底部的虛線邊框,與背景的顏色與點相同。 我試過查找如何設置邊界偏移量,但還沒有找到任何適合我試圖實現的外觀。我也嘗試過使用大綱,只是發現大綱屬性不能特定於單個邊。

+2

這聽起來好像你已經嘗試過的東西和研究你的問題,但你忽略所有這些努力的成果了你的問題。通過分享您嘗試過的內容,您可以大大改善您的問題。 – 4castle

+0

要開始,你可以使用'border-bottom:1px dotted#f00'。將您的標題HTML和現有CSS添加到您的問題中。 – fubar

+0

我在該圖像中看不到任何點。 – 4castle

回答

0

把一個div的方框下面有虛線的邊框樣式:

<div class="box"></div> 
<div class="box-border"></div> 

.box-border{ 
    border-bottom:dashed 3px red; 
} 

https://jsfiddle.net/oo31w9x4/

+0

非常感謝你 – dindae

+0

@indindae不客氣。不要猶豫,點擊勾號;) – symlink

0

可以使用箱陰影作爲背景。

div { 
 
    color: white; 
 
    box-shadow: inset 1000px 0px red; 
 
    border-bottom: 1px dashed red; 
 
}
<div>the header</div>