Fit Width to Content Row Containers - New Thread

@sudsy I’ve heard back from support with new details on how to make this work and I am kind of appalled at the difference here.

First setup below

Result

Second setup below

Result


Screen Shot 2024-08-31 at 12.59.41 PM

What is the difference? Close inspection and it will be seen to be so insignificant, that it makes me angry…the difference is using 0% instead of 0px for the minimum width…ABSOLUTELY nothing else is different, and that to me would imply there is a BUG…we should not have to fiddle with 0% versus 0px to get something to work as expected.

Holy crap, i never thought to try that.

I haven’t checked yet but the difference is probably in the width values of the element. Use the browser inspector.

0px would equal 0% wouldn’t it? There should not be a difference in behavior between 0px and 0%. Both should have the same behavior.

Are you sure that nothing is different in the parent container? Because this doesn’t make any sense. :thinking:

Yes, I’m sure

Wow. Yeah, I would agree that’s certainly unexpected. Even if it works consistently across all supported browsers and OS’s, I have to believe it’s more a “quirk” of implementation rather than an intentionally designed feature. It’s hard to imagine that anyone would intuit such behavior.

:face_with_raised_eyebrow:

Thanks for sharing.

This is what support has replied

Thanks again for your continued patience! I’ve just received word from our Engineering team regarding this discrepancy when using 0% vs. 0px for the min-width.

It turns out that using 0% width inside a group that is fitting its width to content is something that is not well-defined in the CSS spec. This ends up causing the browser to do whatever it wants (in this case, essentially enabling fit width to content). On the other hand, using 0px width instead is something that is well-defined — because the text element does not fit its width to its content, it picks the minimum size (in this case, 0px).

In other words, it appears this is a CSS-related behavior rather than a bug in Bubble’s code.

Wow… I’ve ran into this issue numerous times without realizing it. I have a different fix for that and I’m not sure I’ve ran into the issue recently. I believe I just wrap the text but I’m not sure.

What do you mean by wrap the text?

In a container.