Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap popover width for popover-inner

I would like the have a Bootstrap Popover be wider. I read that this should work:

.popover-inner a {    width: 600px; } 

But, the browser console still shows auto with the above code. Hard to describe. Here is a snapshot:

enter image description here

like image 535
Reddirt Avatar asked Apr 02 '13 23:04

Reddirt


People also ask

How do I customize bootstrap popover?

To create a popover, you need to add the data-bs-toggle="popover" attribute to an element. Whereas, popover's title and its content that would display upon trigger or activation can be specified using the title and data-bs-content attribute respectively. Here is the standard markup for adding a popover to a button.

How do I change popover content?

data-toggle="popover" shows the popover and sets the content based on the data-content , while at the same time your . on('click'...) function hides it, changes the content, then shows it.

How do you use bootstrap Popovers?

To create a popover, add the data-toggle="popover" attribute to an element. Note: Popovers must be initialized with jQuery: select the specified element and call the popover() method.


2 Answers

Based off of what I have in my bootstrap.css file, the default is a max-width property.

I use this

.popover {   position: absolute;   top: 0;   left: 0;   z-index: 1010;   display: none;   max-width: 600px;   padding: 1px;   text-align: left;   white-space: normal;   background-color: #ffffff;   border: 1px solid #ccc;   border: 1px solid rgba(0, 0, 0, 0.2);   -webkit-border-radius: 6px;      -moz-border-radius: 6px;           border-radius: 6px;   -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);      -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);           box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);   -webkit-background-clip: padding-box;      -moz-background-clip: padding;           background-clip: padding-box; } 

and it works exactly how you intended it to.

My bootstrap.css files does not contain a popover-inner a css selector at all though

like image 189
lbdm44 Avatar answered Nov 12 '22 23:11

lbdm44


There's a pull request on bootstrap to make this easier, but you can modify it using this technique of setting the template option for the popover:

$('#yourPopover').popover({   template: '<div class="popover special-class"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>' }) 

Then you can set your popover special-class css however you like (widths and more!)

like image 45
Mike Atlas Avatar answered Nov 12 '22 23:11

Mike Atlas