How can I make a div width to be twice the width of it's min-content.
I think calc shall come into play.
10 Replies
if your div has a width of
min-content
i don't believe vanilla css actually allows you to add values even with calc onto it since min-content
isn't a numerical value.As mentioned, pretty sure that's not quite possible. The only possible way is using javascript. You'd have to set width to min-content, get the computed value, and then multiply it by 2. It's really a horrible way to do something like that but 🤷♂️
Thanks guys.
No worries
Why would you guys not be using
transform: scaleX(2);
?
and making width min-content
@pinkfrog9 have you tried that?ScaleX stretches the text. @coffee_nerd
can't you just be more specific with your scope and separate the text?
if you've got code to share, that would make helping a lot easier. Check out #how-to-ask-good-questions for tips on how to share your code @pinkfrog9
Unfortunately I don't believe so unless you want to use absolute and relative positioning. Have the the content and background wrapped in a parent div with position relative. Scale the background, then position the text. However, given all that, I think the point is he wants the text container to also increase in width without scaling the font size
I'll have a play with it. It's likely very possible, just not common