4 ms·
Would it be better to use the css border-image property? If you don't want to use images I guess you could embed svg in it. That should give you around 98% of a
by hiccuphippo 7y ago
Would it be better to use the css border-image property? If you don't want to use images I guess you could embed svg in it. That should give you around 98% of all browser users according to caniuse.
- James0x57 7y agoBorder image property with svg was one of the first approaches I tried and tried. It got about half way to about half the options and required more setup than just a single CSS file. I got slightly further to what I wanted with border-mask, but still fell really far short. Some of the biggest limits on both of those is: 1) the size definitions is only 4 numbers so same-edge corners share a dimension (reasonable but very limiting) 2) changing the color of the border required more effort than setting a css property 3) doing more than using a color was a no-go without hands-on svg work and dom insertion required. 4) applying it to a larger element meant the border got wider. You'd have to have separate svg parts for each width built in, which sucks. It took almost a week before I realized I could do everything I wanted by using clip-path. As soon as I did though, I went all in. Clip path was the most work up front but resulted in the most possible options, the easiest setup, and the easiest general use. Borders and the inset are full-featured CSS backgrounds that support practically anything, the augs along the edge could have different positions with simple css properties, it scaled to any element without changing the border width or inset distance, and it all worked out of the box with a single CSS file added to your project.
- hiccuphippo 7y agoThank you for all the insight. I'll be sure to keep clip-path in mind.