How can I use a carriage return in a HTML tooltip?

前端 未结 27 1259
说谎
说谎 2020-11-22 11:59

I\'m currently adding verbose tooltips to our site, and I\'d like (without having to resort to a whizz-bang jQuery plugin, I know there are many!) to use carriage returns to

相关标签:
27条回答
  • 2020-11-22 12:47

    According to this article on the w3c website:

    CDATA is a sequence of characters from the document character set and may include character entities. User agents should interpret attribute values as follows:

    • Replace character entities with characters,
    • Ignore line feeds,
    • Replace each carriage return or tab with a single space.

    This means that (at least) CR and LF won't work inside title attribute. I suggest that you use a tooltip plugin. Most of these plugins allow arbitrary HTML to be displayed as an element's tooltip.

    0 讨论(0)
  • 2020-11-22 12:47

    I have tried with " " to display title text in new line and it's work like a charm

    0 讨论(0)
  • 2020-11-22 12:49

    hack but works - (tested on chrome and mobile)

    just add no break spaces   till it breaks - you might have to limit the tooltip size depending on the amount of content but for small text messages this works:

       etc
    

    Tried everything above and this is the only thing that worked for me -

    0 讨论(0)
提交回复
热议问题