+ 1

Css borders 🖼️

Can i use 2 borders in css and add 2 different colors ???

20th Feb 2022, 2:08 PM
CODY RAZA ツ - avatar
3 Answers
+ 1
A workaround is using box-shadow: inset 0 0 0 5px red; less positioning problems than border.
20th Feb 2022, 2:29 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
+ 2
A box element can have just ONE border but in css, a border is subdivided into 4 and they can have different styling that matches your preference border-left border-right border-top border-bottom if your objective is to have different outlines for a box, I think you can embed your target box into N boxes. N boxes are parent element to your target box and they should've have a relative size(width, height) with your target box, then you can apply different borders to them and increase the css attribute `border-width` RELATIVELY <Nbox1> <Nbox2> <target box> there may be other possible solutions
20th Feb 2022, 2:12 PM
Mirielle - avatar
Use padding instead, you can also pad the border.
20th Feb 2022, 4:40 PM
T.Coded - avatar