2016-08-11 53 views
0

我試圖在鼠標上顯示彈出窗口。 我遇到的問題是增加popover框的大小。增加彈出窗口的寬度

這裏是Plunker

我試着調整使用CSS的寬度,如下圖所示:

.popover-inner { 
width: 400px; 
} 
.popover-content { 
width: 500px; 
} 

,但沒有幫助。

+0

[UI引導酥料餅:改變寬度]的可能的複製( http://stackoverflow.com/questions/29005345/ui-bootstrap-popover-change-width) – 3rdthemagical

+0

[更改Bootstrap彈出窗口寬度]的可能重複(http://stackoverflow.com/questions/19448902/changing-the -bootstrap-popover) – c0d3rman

回答

1

關於你的代碼和你的問題,問題是你試圖編輯一個元素而沒有正確的選擇器(.popover)。當你嘗試編輯正確的選擇器時,它有一個max-width property。所以它不起作用。但足夠用

.popover { 
    max-width: 500px; 
    } 

就這樣。

但我嘗試你的plnkr,發現你在代碼中使用了模態類。這是一個錯誤。因爲這不是css的語法或用法。所以我添加新的CSS類:

.popover-content > .header { 
    padding: 15px; 
    border-bottom: 1px solid #e5e5e5; 
} 
.popover-content > .body { 
    padding: 20px; 
} 

並更改popover.html到:

<div class="header"> 
    <b>How is this amount calculated?</b> 
</div> 
<div class="body"> 
    <h4>PQ * A% * CR AVG </h4> 
    <br /> 
    PQ - Pre-Qualified based on your historical data <br /> 
    A% - Approval percentage <br /> 
    CR AVG - (Historical Credits Earned)/(Total Certificates) 
</div> 
http://angular-ui.github.io/bootstrap/ 

您可以檢查我的plnkr叉:https://plnkr.co/edit/p4dr2XMzQqw8R6RYOsMo?p=preview

1

試試這個:

.popover-inner { 
    width: 500px !important; 
    max-width:500px !important; 
} 
.popover { 
    width: 500px !important; 
    max-width:500px !important; 
} 

這需要在!important exception的優勢,應用的樣式。

當在樣式聲明中使用重要規則時,該聲明將覆蓋任何其他聲明。

+1

每t ime你使用!重要的CSS代碼。上帝殺死一隻貓。 :(請不要使用!重要的是如果沒有必要的話 – joseglego

+0

@JoséLezama在你沒有擁有樣式表IMO的情況下使用!重要沒有錯如果是他自己的樣式表,那麼不需要!重要的 –

+1

事實上,'important'有你自己的時間,這是真的!正如你所說的那樣,通常需要覆蓋第三方的css,但在這種情況下,這是沒有必要的!用我之前提出的代碼,或者在問題的評論中提出的其他回答,那麼,如果你可以不使用'!important',那麼'重要'是不必要的使用。所以,一隻貓死了。如果你想要,你可以閱讀:https://css-tricks.com/when-using-important-is-the-right-choice/ @HanletEscaño – joseglego

相關問題