T
T
tripcollor2018-02-13 14:59:52
css
tripcollor, 2018-02-13 14:59:52

How to achieve auto block width with position: absolute; depending on the text inside with a limit of max. width?

There is a task to make a custom tooltip on hover in the sandbox of the code.
The problem is that you need to set the maximum width that the tooltip block can have, and until that moment the block should be of automatic width, therefore, when the max width is reached, the text inside should adjust and wrap.
If we remove the white-space: pre; then the words will be wrapped after each word and there will be a column of words, which is not very acceptable.
Help solve this problem

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey delphinpro, 2018-02-13
@tripcollor

For example like this https://jsfiddle.net/wecrs39n/5/

S
Stimulate, 2018-02-13
@Stimulate

https://jsfiddle.net/wecrs39n/3/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question