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

前端 未结 27 1262
说谎
说谎 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:35

    This 
 should work if you just use a simple title attribute.

    on bootstrap popovers, just use data-html="true" and use html in the data-content attribute .

    <div title="Hello &#013;World">hover here</div>

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

    use data-html="true" and apply <br>.

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

    &#13; will work on all majors browsers (IE included)

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

    Just use this:

    <a title='Tool&#x0aTip&#x0aOn&#x0aNew&#x0aLine'>link with tip</a>
    

    You can add new line on title by using this &#x0a.

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

    Razor Syntax

    In the case of ASP.NET MVC you can just store the title as a variable as use \r\n and it'll work.

    @{ 
        var logTooltip = "Sunday\r\nMonday\r\netc.";
    }
    
    <h3 title="@logTooltip">Logs</h3>
    
    0 讨论(0)
  • 2020-11-22 12:42

    The latest specification allows line feed character, so a simple line break inside the attribute or entity &#10; (note that characters # and ; are required) are OK.

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