Forum Academy Marketplace Showcase Pricing Features

Automatically adjust the length of the text box depending on the content

Hello.
What I want to achieve is this.

This is the part I’m struggling with.
image

I want to display the “icon”, “name”, and “show profile button” of the person I’m talking to, side by side, in the center.

However, there are some problems here.

  1. The width of the text cannot be automatically adjusted according to the content.
  2. If it can be adjusted automatically, the number of characters per line cannot be specified.
  3. Even if it can be automatically adjusted, it is not possible to center the “icon”, “name”, and “button to display profile” together.

For those of you who will see this in the future
I’d like to leave the code for it here when it’s solved.

Please help me.

Hi @makara

Please, see if this is what you are looking for:

I hope this can help you!

1 Like

Thanks for the replies!
@mateusproto

I’ve been trying to…
This only seems to change the height and width of the element in %, and I couldn’t see if I could specify more than 100.

I also need to calculate the width of the text.
This solution may be a bit difficult.

@makara

I am sorry the plugin I would like to refer is that:

When I used this plugin, it adjusted the width to the text size.

If it is what you need, after that, you could try to get the element by ID and at the end find its width.

1 Like

Thank you!
Thanks for your help, I solved the problem.

Glad to hear that!

1 Like

Oh,

I couldn’t solve the third problem with the center selection.

If you have any ideas, please let me know!

In my app I replaced icons per images and set a style centralizing everything, because I realized the plugin removes the styles to fit the width. Please, check it if can help you.

thank you!

As a countermeasure against deletion
I wrote in the html section that it should be centered. Is that correct?

Excelent :clap:! That works too and in the html you can have your own styles set. It gives you more flexibility.