Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap modal which has the width of it's image inside [closed]

I am using the bootstrap modal to show images and I would like that the width of this modal to be the same as the image inside.

Here is the Plunker of what I have tried so far. Without any extra css the width of the modal-dialog is constant and equal to 600px and if we put width:auto it just extends the width of the modal to the maximum (that's why I have put max-width:90%)

Any idea to do so?

(The object tag is fine I need to use it for others reasons)

Thanks!

like image 1000
VDarricau Avatar asked Dec 24 '22 14:12

VDarricau


1 Answers

By default Block elements will expand to the width of their parent, setting to display:inline-block will default the width to a child element with layout

.modal-dialog{text-align:center;}
.modal-content{display:inline-block;}

http://plnkr.co/edit/QF2jp2KJKgAyNEz8tHQA?p=preview

like image 188
sjm Avatar answered Dec 27 '22 02:12

sjm