agerrr agerrr - 3 months ago 35
HTML Question

Aligning text in bootstrap tooltip

Bootstrap tooltip aligns text to the middle by default. I'd like to align to the left. Is there any nice way of doing this within HTML, instead of modifying CSS file?

Here is my sample code:

<p rel="tooltip" title="Text in tooltip I want to align">Hover over here</p>

<script type="text/javascript">
$(document).ready(function () {

I've already tried but it didn't work:

<p rel="tooltip" data-html="true" title="<p align='left'>Text in tooltip</p>">Hover over here</p>


Have you tried this one?

 .tooltip > p {

Also I do not think that including HTML code in tooltip title. What you should do is:

  html: true,
  title: '<p align="left">Text in tooltip</p>'

Also referring to paragraph by p is a bad idea, as you could have many of them in your document. Refer by an id instead:

 <p id="myparagraph"> Hover over here </p>