1

ブートストラップのポップオーバーで問題が発生しており、それを回避するためにスタイルを設定しようとしています。問題は、子コンテンツがスパン内にネストされている場合、親の幅を埋めないことです。ブートストラップ スタイルは、相対位置を使用してスパンされます。

私が持っている唯一の回避策は、.popover クラスに静的な幅を設定することです。これを回避する方法はありますか?問題はsupに関係していると思いますが、display:inlineobvを変更すると<sup>[1]</sup>行が途切れます。

フィドルリンク


html:

<div class='parent'><p>I need the text to look normal <sup class="reference">[1]</sup> every where</p></div>

js:

$('.reference').html($('.reference').html() + "<div class='test'>" +
    "<h3>Title</h3>" +
    "THis is my random text, that I need to be almost, about this length, maybe a little more... well yea this is enough.<em>Thanks.</em> 6. <a href=\"http://www.google.com\" target=\"_blank\">[pdf]</a>" +
    " </div>");

CSS:

sup {
    position: relative;
    top: -0.5em;
}
.parent {
    width: 600px;
    height: 200px;
    background-color: yellow;
}
.test {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1010;
    display: none;
    max-width: 400px;
    padding: 1px;
    text-align: left;
    background-color: #ffffff;
    background-clip: padding-box;
    border: 1px solid #ccc;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border-radius: 6px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
    white-space: normal;
    opacity: 1;
    display: block;
    top: 90px;
}
4

1 に答える 1