body {
text-align:center;
}
a {
display:inline-block;
text-decoration:none;
color:inherit;/* will use parent color if not reset */
margin:1em;
padding:0.5em 1em;
background: /* lets draw the background image via current color if text color is to be matched */
linear-gradient(45deg, transparent 0.5em, currentcolor 0.5em, currentcolor calc(0.5em + 2px), transparent calc(0.5em + 2px)),
linear-gradient(-45deg, transparent 0.5em, currentcolor 0.5em, currentcolor calc(0.5em + 2px), transparent calc(0.5em + 2px)),linear-gradient(225deg, transparent 0.5em, currentcolor 0.5em, currentcolor calc(0.5em + 2px), transparent calc(0.5em + 2px)),linear-gradient(-225deg, transparent 0.5em, currentcolor 0.5em, currentcolor calc(0.5em + 2px), transparent calc(0.5em + 2px)),
linear-gradient(to left, currentcolor, currentcolor) top no-repeat,
linear-gradient(to left, currentcolor, currentcolor) bottom no-repeat,
linear-gradient(to top, currentcolor, currentcolor) left no-repeat,
linear-gradient(to top, currentcolor, currentcolor) right no-repeat;
/* resize gradient/image in order to draw pieces needed */
background-size:
auto auto,
auto auto,
auto auto,
auto auto,
calc(100% - 1em - 6px) 2px,
calc(100% - 1em - 6px) 2px,
2px calc(100% - 1em - 6px),
2px calc(100% - 1em - 6px)
;
}
/* find out the purpose of currentcolor here */
:nth-child(1) {
color:purple
}
:nth-child(2) {
color:gold
}
:nth-child(3) {
color:pink
}
:nth-child(4) {
color:tomato
}
:nth-child(5) {
color:turquoise
}
/* increase size via padding ? */
:nth-child(6) {
padding:1em 2em;
color:gray
}
<a href="#">button link</a>
<a href="#">button link</a>
<a href="#">button link</a>
<a href="#">button link</a>
<a href="#">button link</a>
<a href="#">button link</a>
如果你想讓人幫助你,你需要分享一些代碼,以及你已經嘗試過的東西。 –
這不是一個代碼寫作服務;堆棧溢出爲編碼問題提供基於志願者的故障排除。請提供您編寫的代碼示例,以便我們能夠就如何糾正您遇到的問題向您提供建議。 –
您可能必須使用圖形創建。我不認爲有一個可靠的CSS來做到這一點。 – durbnpoisn