1
I’m having a problem with a menu dropdown
that I made using Bootstrap.
The problem is this, the menu worked perfectly for size devices XS. However, it does not work on size devices SM (That’s what I wanted. I would like the menu to be used also in Tablets).
I’ve searched several forums and I still can’t find an answer. I’ll leave the code down here, see if you can help me. Thanks for your attention.
<!------------ MENU MÓVEL -------------->
<nav class="navbar navbar-default hidden-md hidden-lg navbar-fixed-top " id="nav-movel">
<!--------- DIV DAS REDES SOCIAIS ----------->
<div class="row visible-xs visible-sm" id="cabecalho-superior-movel">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" id="cabecalho-superior-acerto">
<a href="https://www.facebook.com/jcacontadores/" target="blank"><img src="_imagens/icones/footer_redesFace.png"></a>
<a href="https://www.instagram.com/jcacontadores/" target="blank"><img src="_imagens/icones/footer_redesInsta.png"></a>
<a href="https://www.linkedin.com/in/jca-contadores-406/" target="blank"><img src="_imagens/icones/footer_redesLink.png"></a>
<a href="https://www.youtube.com/channel/UCLb6KnKGdjKh-usDWdZ93yg?view_as=subscriber" target="blank"><img src="_imagens/icones/footer_redesYouTube.png"></a>
<a href="https://encurtador.com.br/gOPZ6" target="_blank"><img src="_imagens/icones/icone-zap.png"></a>
<a href="mailto:[email protected]"><img src="_imagens/icones/icone-email.png"></a>
<a href="#" data-toggle="modal" data-target="#modal-contato"><button class="btn btn-info btn-sm">Fale com um Especialista</button></a>
</div>
</div>
<section class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#movelmenu" arial-expanded="false">
<span class="sr-only">Toggle Navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="index.php" class="navbar-brand" target="_blank">
<img src="_imagens/logo-216x93.png" class="logo-menu-movel">
</a>
</div>
<div class="collapse navbar-collapse" id="movelmenu">
<ul class="nav navbar-nav" id="ul-movel">
<li class="" id="li-menu-movel"><a href="index.php">HOME</a></li>
<li class="" role="presentation" class="dropdown" id="li-menu-movel">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
SOBRE<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li class="li-submenu-movel" id="li-submenu-movel"><a href="quemsomos.php" target="blank">QUEM SOMOS</a></li>
</ul>
</li>
<li class="li-menu-movel" id="li-menu-movel"><a href="#">SERVIÇOS</a></li>
<li role="presentation" class="dropdown li-menu-movel" id="li-menu-movel">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
CARREIRAS<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li id="li-submenu-movel" ><a href="contato-despertando.php" target="blank">PROGRAMA DESPERTANDO TALENTOS</a></li>
<li class="li-submenu-movel" id="li-submenu-movel" ><a href="contato-profissionais.php" target="blank">PROGRAMA PROFISSIONAIS EXPERIENTE</a></li>
</ul>
</li>
<li id="li-menu-movel"><a href="https://jcasistemas.info/">BLOG</a></li>
<li id="li-menu-movel"><a href="#" data-toggle="modal" data-target="#modal-contato">CONTATO</a></li>
<li id="li-menu-movel"><a href="location.htm">ÁREA DO CLIENTE</a></li>
</ul>
</div>
</section>
</nav>
Hello, hugocsl friend. Thank you for the return. As I said, my menu is working perfectly in size "XS" (Mobile), the problem is that it is not working in size "SM" (Tablet), and it is this size that I would like it to work. In your example, it is working perfectly, however, you are using 722px width (XS size). In this size of XS mine also works. My problem is that it doesn’t work in the size "SM" (which is 768px up to 992px). If you can give me a solution on how to make the menu work in sizes other than "XS", I would be grateful.
– Gato de Schrödinger
@Thiagopetherson was that you had put the tag [Bootstrap-4] in your question, then got confused. But now I understood what you wanted. Read the EDIT which I did in response that you will see that now at 992px the collapsa menu in the toggle menu
– hugocsl
At first glance, it all worked out on the menu. But when he looked better, he came kind of with the <li>, I mean the submenus, kind of buggers and side paddings.
– Gato de Schrödinger
I would like this Menu to be visible in XS and SM and be Hidden in MD and LG sizes. I’m cracking my head to do this in bootstrap.
– Gato de Schrödinger
@Thiagopetherson guy just did a general update, now it works as expected, one of the problems with the bug you talked about is pq vc had put a Section with class . container inside the navbar, this broke the layout. And now the LI expands correctly. In addition I put the Hidden class back in the navbar, but this way on screens larger than 992px the navbar disappears completely, so on screens larger than 992px no more visible menu.. Try it on and tell me
– hugocsl
Speak there, my wizard. Now it’s all right. I just had to adjust some paddings and margins of your css. But it was minimal. Thank you so much for your help. Big hug !
– Gato de Schrödinger
One last question. Why am I only able to use this CSS code in the <style> area of the page and not in an external CSS file that I call on the page ? 'Cause then I’ll have to create this CSS code on every page of the site...
– Gato de Schrödinger
@Thiagopetherson is that Bootstrap has a very strong Class Hierarchy, you can even put in a file . Separate CSS, but you might need to use
!important
in the properties. Another detail is that this . CSS should come later, below the . CSS of Bootstrap ok! Do the test by putting it that way and talk to me. If you think the question has been answered remember to mark it as accepted in this icon ✔ next to the arrow, so your question is not pending on the site. And if you have any more problems just give me a tap– hugocsl
I really appreciate the tips. I am making a website for the company where I do internship. I’m using html,css,javascript, bootstrap, jquery and a minimum of php. I wonder if you could take a look at the site, even if superficially, and give me some improvement tips. It can be layout improvements, SEO... Goataria to leave the site light, beautiful and functional. The site is thiagopetherson.tech . Thank you very much for your patience. Hug-
– Gato de Schrödinger
@Thiagopetherson guy actually I’m just an rss designer, I don’t have all this knowledge to give you this "consulting", but I noticed that the site does not have ALT on all images, this is not good for SEO or Accessibility. You can Condense all . CSS into one in the version that will be published on the server this will help the site to load faster. I would leave the text of the Services centralized for mobile screens. And if you think that this question is solved mark as accepted in the icon ✔ beside the little arrows at the top the left of my answer. []s
– hugocsl