Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make the kendo tooltip content left justified

I have a kendo tooltip that is displayed when I hover over a row in a kendo grid. The content of the tooltip has multiple lines. The lines are displayed centered by default whereas I would like to have them displayed left justified.

    rowTable.kendoTooltip({
                               content: textToBeDisplayed,
                               position: "bottom"
                           });
like image 767
Claritta Avatar asked Apr 21 '15 15:04

Claritta


3 Answers

You can override the .k-tooltip-content CSS class.

 .k-tooltip-content {
        text-align:left;
    }

See this jsFiddle example

like image 143
codingbadger Avatar answered Nov 04 '22 08:11

codingbadger


For those of you who don't want to override the css class. I added "in-line" styling on the content.

.Content("<div style='text-align:left;'> " + myContent + "</div>")
like image 30
scully Avatar answered Nov 04 '22 09:11

scully


Codingbadger's answer is correct, but it overrides styles for all tooltips that you have on a page.

Here is an example where styles are changed only for the specific tooltip: http://jsfiddle.net/NameGrey/d4b0ez4n/5/

$(document).ready(function() {
  $("#target").kendoTooltip({
    position: "right",
    width: "200px",
    content: "<div class='my-tooltip'>Tooltip content with <b>solid example</b></div>"
  });
});

Css:

.my-tooltip {
    text-align: left;
  font-size: 20px;
}
like image 1
Sergey_T Avatar answered Nov 04 '22 09:11

Sergey_T