CSS Border Colour Into 4 Colours

前端 未结 6 1765
走了就别回头了
走了就别回头了 2021-01-12 01:49

Is there any way that I can have 4 different colours on one side of a border in CSS? I currently have

#header
{
border-color:#88a9eb;
}

I w

6条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-12 02:35

    Complicated but cool solution: Use SVG (e.g. tag), add 4 paths, assign different stroke-dasharray and stroke-color attributes.

    Simpler and still cool solution: Try border-image. (See Harry's answer)

    Very simple solution if you just need one border: Create an image, but it as the background image, repeat it only on one axis, position it at the edge of the container, e.g. (for bottom border)

    .container {
        background-image: url(image.png);
        background-repeat: repeat-x;
        background-position: bottom left;
    }
    

提交回复
热议问题