CSS Bootstrap Popover 需要设置 data-original-title 的样式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22080574/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 01:59:39  来源:igfitidea点击:

Bootstrap Popover need to style data-original-title

csstwitter-bootstrappopover

提问by DivineChef

Created a popover in bootstrap that has a title (data-original-title). How can I make it bold?

在引导程序中创建了一个具有标题(数据原始标题)的弹出窗口。我怎样才能让它大胆?

<td class="setWidth concat"><div class="boldTitle"><a href="#" class="tip" rel="popover"             data-trigger="hover"  data-content="Hypercholesterolemia is a condition characterized by very high levels of cholesterol in the blood. Cholesterol is a waxy, fat-like substance that is produced in the body and obtained from foods that come from animals (particularly egg yolks, meat, poultry, fish, and dairy products). The body needs this substance to build cell membranes, make certain hormones, and produce compounds that aid in fat digestion. Too much cholesterol, however, increases a person's risk of developing heart disease." 

data-original-title="Hypercholesterolemia">

<span style="cursor:pointer;">Hypercholesterolemia</span></a></div></td>

Fiddle Link http://jsfiddle.net/DivineChef/8J5w6/1/

小提琴链接http://jsfiddle.net/DivineChef/8J5w6/1/

回答by Alp

Here are three possibilities to achieve your goal.

以下是实现目标的三种可能性。

  1. Use data-html=trueand wrap your title in a <strong>element

    <a href="#" class="tip" rel="popover"
       data-trigger="hover" data-content="Hypercholesterolemia..."
       data-original-title="<strong>Hypercholesterolemia</strong>"
       data-html="true">Hypercholesterolemia</a>
    

    DEMO with data attribute

  2. Use html: truewhen initializing and wrap your title in a <strong>element

     $('[rel=popover]').popover({ html : true });
    

    DEMO with popover param

  3. Change the appearance of ALLpopover titles with CSS

    .popover .popover-title {
        font-weight: bold;
    }
    

    DEMO with general popover css

  1. data-html=true<strong>元素中使用和包装您的标题

    <a href="#" class="tip" rel="popover"
       data-trigger="hover" data-content="Hypercholesterolemia..."
       data-original-title="<strong>Hypercholesterolemia</strong>"
       data-html="true">Hypercholesterolemia</a>
    

    带数据属性的DEMO

  2. 使用html: true初始化时,敷你的标题在<strong>元素

     $('[rel=popover]').popover({ html : true });
    

    带弹出框参数的演示

  3. 使用 CSS更改所有弹出窗口标题的外观

    .popover .popover-title {
        font-weight: bold;
    }
    

    带有一般popover css的DEMO