twitter-bootstrap 如何自动调整弹出框的大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14496514/
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-10-21 16:11:06  来源:igfitidea点击:

How to Autoresize popover

csstwitter-bootstrap

提问by zevy_boy

Here is my fiddle. http://jsfiddle.net/sNrLQ/1/

这是我的小提琴。 http://jsfiddle.net/sNrLQ/1/

I want the pop-over to autoresize based on its content. Also I am trying to give it a max width of 400px.

我希望弹出窗口根据其内容自动调整大小。另外我试图给它一个 400px 的最大宽度。

My css

我的CSS

.popover2{display:block!important;width: 400px !important;}

And my html

还有我的 html

<div class="popover popover2 left"><div class="arrow"></div><div class="popover-content"><p>tellus. Donec dui tortor, commodo nec laoreet ac, </p></div></div>

回答by SarathSprakash

DEMO

演示

Try this

试试这个

css

css

.popover2{
    display:block !important;
    max-width: 400px!important;
    width:auto;
}

Hope this helps ,Thank you

希望这会有所帮助,谢谢

回答by saad arshad

use min-heightmax-h css property and overflow:auto

使用min-heightmax-h css 属性和overflow:auto

and usually, if youre using twitter bootstrap, the auto resizing is already taken care of, cross-browserly :)

通常,如果您使用 twitter bootstrap,自动调整大小已经被处理,跨浏览器:)

回答by Kelwin Gamez

You most configure the max-width inside boostrap.min.css. The information is resized automatically with a max width pre-set in the file.

您最常在 boostrap.min.css 中配置 max-width。信息会根据文件中预设的最大宽度自动调整大小。

回答by zvadym

I hope it will be usefull

我希望它会有用

var $btn = $("#my_btn")
  .popover()
  .on("show.bs.popover", function(e){
    p.data("bs.popover").tip().css({"max-width": "500px"});
  });