After seeing this post and this clever solution, I wanted to give it a go, as it appears to be a common request on the forum.
It seemed like it should be doable with just CSS, and indeed, it turned out to be pretty straightforward…
Text Element Settings
Make sure Fit width to content is not enabled
Make sure it has noFixed or Max height
If parent is a Column container, make sure Fit height to content is enabled (on the text element)
Then just target the text element via CSS selectors in whatever way you choose (it’s done using an id in the snippet below), and add the following CSS properties:
I discovered this approach was already mentioned in this tip, but that was for the old responsive engine, so consider this post an update and confirmation that it works with the new responsive engine.
Came looking to see if there was some obvious native solution to this I’ve been missing, apparently not the case!
I’m an old CSS head so this kind of declaration isn’t an issue for me, but the fact that you have to do it for something so simple blows my mind. I’m pretty sure it used to function normally too, before the new responsive engine (which is overwhelmingly a good thing, don’t get me wrong ).
Hopefully bubble add in a checkbox for this soon, alongside overflow controls on groups, as that’s another simple yet laborious CSS task that shouldn’t really exist.
Just to add, I’ve just used exactly this method on a text element, but had to go one child deeper since there’s a sub-div that actually contains the text.
In case anybody else runs into this issue, it’s a small adjustment to select any child div:
Yeah, Bubble will add an extra div in certain contexts or when specific settings are enabled. For the Text element, this happens when the “Center the text vertically” option is enabled (which I rarely use). In most situations, the additional selector specificity is not needed.
Also, the “old” ellipsis technique still works, but only under certain circumstances with specific layout settings. It does not use CSS though; the text is actually truncated before being rendered.
Ah that’s really interesting, I didn’t actually know it was setting dependent. I’m lazy so I use centre text vertically then add 1px of padding to the top, rather than using flex controls to make the text actually centred. Far from perfect but it does the job haha