I don't need the box to stay the same height, I don't mind it getting longer. Just not wider
here's how i would do it:
https://codepen.io/ribozone/pen/VYPqxLPif you care about the width of the card and not the height, set the
width explicitly in your code and let the
height adjust automatically. my example has it set to 225px, and i chose the
border-image-widths based on what looks right for that size. if you want the card to be larger or smaller, i would scale the
width and the
border-image-width values up or down by the same value (e.g. multiple them all by 1.5 or some other number), so the ratios stay the same.
the
padding is the part of the code that moves the text away from the edges of the container and into the position you want it to be, and those values should be close to what the
border-image-width values are. in Noah_S's version above, they match exactly, and in my version there's a few pixels extra added to the left and right padding.
i also changed the border-image-slice values to percentages and moved them near the end, because they should work fine no matter the size card you choose!