I am trying to create a dropdown menu with Bootstrap, with images and a long text, that may have to be word-wrapped to be inside a width of 500px
I tried suggestions like this:
.dropdown-menu {
width: 500px;
white-space: normal;
}
Here is my fiddle: http://jsfiddle.net/azu0zwrr/
Any ideas?
Try to add :
overflow: hidden;
.dropdown-menu li{
width: 500px; white-space: normal;overflow: hidden;
}
.img-thumbnail {
width:75px;height:75px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-dropdown.js"></script>
<link target='_blank' href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet"/>
<div class="btn-group"><button aria-expanded="true" data-toggle="dropdown" class="btn btn-primary btn-lg dropdown-toggle" type="button">Selecione um produto <b class="caret"></b></button><ul class="dropdown-menu"><li><a><img class="img-thumbnail hidden-xs" src="http://www.extra-imagens.com.br/Control/ArquivoExibir.aspx?IdArquivo=107393037"> Tablet Multilaser ML Supra Quad Core com Tela 7”, 8GB, Wi-Fi, Android 4.4, Suporte à Modem 3G e Processador Quad Core - Rosa</a></li><li><a><img class="img-thumbnail hidden-xs" src="http://www.extra-imagens.com.br/Control/ArquivoExibir.aspx?IdArquivo=107392987"> Tablet Multilaser ML Supra Quad Core com Tela 7”, 8GB, Wi-Fi, Android 4.4, Suporte à Modem 3G e Processador Quad Core - Branco</a></li></ul></div>
Add this to your css:
.dropdown-menu li a {
word-wrap: break-word;
white-space: normal;
}
fiddle: https://jsfiddle.net/1usvrs3e/
Check this out This should be working for you
<li ><a><p style="word-wrap: break-word;" ><img class="img-thumbnail hidden-xs" src="http://www.extra-imagens.com.br/Control/ArquivoExibir.aspx?IdArquivo=107393037"> Tablet Multilaser ML Supra Quad Core com Tela 7”, 8GB, Wi-Fi, Android 4.4, Suporte à Modem 3G e Processador Quad Core - RosaaSdad</a></p></li>
Hello say i have an array of objects that looks like this let myArray = [ {item1: true}, {item2: false}, {item3: true}, {item4: false} ] How would I iterate though this to return a new array ...
Hello say i have an array of objects that looks like this let myArray = [ {item1: true}, {item2: false}, {item3: true}, {item4: false} ] How would I iterate though this to return a new array ...
I have a problem. I just started learning jQuery, my first experience with javascript at all. And I want to make an element animate on click, and I did make that work: HTML: <h1>Testing</h1&...
I have a problem. I just started learning jQuery, my first experience with javascript at all. And I want to make an element animate on click, and I did make that work: HTML: <h1>Testing</h1&...
const map = {} for (let i=0;i<10**5;i++) { map[i] = true } let ans = 0 for (let i in map) { for (let j in map) { ans += i+j } } console.log(ans) The above code when run ...
const map = {} for (let i=0;i<10**5;i++) { map[i] = true } let ans = 0 for (let i in map) { for (let j in map) { ans += i+j } } console.log(ans) The above code when run ...
I'm using RSpec + capybara, and the capybara-webkit as driver. I have to check if a JS box exists in the page after clicking on a button, but with no results. If I use selenium as a driver, the test ...
I'm using RSpec + capybara, and the capybara-webkit as driver. I have to check if a JS box exists in the page after clicking on a button, but with no results. If I use selenium as a driver, the test ...