Facing problem while using border-image-slice

I am using this code in order to learn about border-image-slice and other related property. The problem is the unit of value defined for border-image-slice. Eg i get different output if i supply value 35, 35px and 35%. I understand the reason for the %age value, but shouldn't the output for other two be the same? I have also attached the image i am using in this example.
10 Replies
Rägnar O'ock
Rägnar O'ock2y ago
please put your code into a codepen (https://codepen.io). not everyone that wants to help has a code editor at the ready and most people will not download a random file that they know nothing about
capt_uhu
capt_uhu2y ago
for border-image-slice pixel values are done as unit less numbers. 50px is not a supported value. https://developer.mozilla.org/en-US/docs/Web/CSS/border-image-slice#values
Anurag Gupta
Anurag Gupta2y ago
glutonium
glutonium2y ago
in css u need to define unit i do not think only saying 35 would even do anything cause 35 alone can mean anything, px,%,em,rem,vh,vw,rem, anything so u have to define a unit
Anurag Gupta
Anurag Gupta2y ago
In the Codepen, you can set the border-image-slice value to be something like 35, 25px and 35%. Make sure to use the image I supplied (or any other) and see the difference.
glutonium
glutonium2y ago
glutonium
glutonium2y ago
it doesn't chnage anything at all regardless of what value I give there's prolly something off with your code but yaa i looked on web..image slice doesn't require a unit
Anurag Gupta
Anurag Gupta2y ago
Here is the video of issue I want to point to. Please have a look.
capt_uhu
capt_uhu2y ago
I'm well aware that in the vast majority of cases CSS requires units on values. In the specific case of border-image-slice however a value with px at the end is invalid and will produce the same result as if you have no border-image-slice declaration. Please read the MDN doc I linked above
Anurag Gupta
Anurag Gupta2y ago
Thanks! Now I got the reason for this behavior
Want results from more Discord servers?
Add your server