I would like to have three colors on my border-bottom like in the image below. How can I achieve this affect?
3
You can do it with :after or :before psuedo element and css linear-gradient :
body { background: #ccc; } .box { text-align: center; position: relative; line-height: 100px; background: #fff; height: 100px; width: 300px; } .box:after { background: linear-gradient( to right, #bcbcbc 25%, #ffcd02 25%, #ffcd02 50%, #e84f47 50%, #e84f47 75%, #65c1ac 75% ); position: absolute; content: ""; height: 4px; right: 0; left: 0; top: 0; } <div class="box">Div</div>
It Can be easily achieved with 3 div help <!DOCTYPE html> <html> <head> <style> .container{ display:flex; } #div1 { border-bottom-left-radius:50px ; height:15px; width:200px; background-color:#49783f; } #div2 { height:15px; background-color:#682a30; width:150px; } #div3 { height:15px; width:200px; background-color:#bdbdbe; border-bottom-right-radius:50px ; } </ </style> </head> <body> <div class="container"> <div id="div1"></div> <div id="div2"></div> <div id="div3"></div> </div> </body> </html>
Use border images. They’re widely supported in most browsers and are easy to use. Here’s how you can use border images to create this effect:
border-image: url("/somepath/border.svg")
Click here to cancel reply.
3
Answers
You can do it with :after or :before psuedo element and css linear-gradient :
Use border images. They’re widely supported in most browsers and are easy to use. Here’s how you can use border images to create this effect:
border-image: url("/somepath/border.svg")