The css dropdown menu appears fixed within the dojo dijit.layout.ContentPane

Looking at a modified version of the css dropdown, which can be found here:

http://www.w3schools.com/css/tryit.asp?filename=trycss_dropdown_navbar

When inserted into a dijit.layout.ContentPane, instead of floating, a scroll bar appears.

The bug has been traced back to this specific file:

<link rel="stylesheet" href="http://js.arcgis.com/3.13/dijit/themes/claro/claro.css">

Despite this identification, the root cause remains elusive.

Below is the code snippet provided for reference.

<!-- File: css/dropdown.css-->
    ul.dbtul {
        list-style-type: none;
        margin: 0;
        padding: 0;
        overflow: hidden;
        background-color: #333;
    }

    li.dbtli {
        float: left;
    }

    li.dbtli a, .dropbtn {
        display: inline-block;
        color: white;
        text-align: center;
        padding: 14px 16px;
        text-decoration: none;
    }

    li.dbtli a:hover, .dropdown:hover .dropbtn {
        background-color: red;
    }

    li.dropdown {
        display: inline-block;
    }

    .dropdown-content {
        display: none;
        position: absolute;
        background-color: #f9f9f9;
        min-width: 160px;
        box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    }

    .dropdown-content a {
        color: black;
        padding: 12px 16px;
        text-decoration: none;
        display: block;
        text-align: left;
    }

    .dropdown-content a:hover {background-color: #f1f1f1}

    .dropdown:hover .dropdown-content {
        display: block;
    }
 <!DOCTYPE html>
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
        <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">              
        
        <link rel="stylesheet" href="http://js.arcgis.com/3.13/dijit/themes/claro/claro.css">>         
    <style type="text/css">  
        html, body { height: 100%; }     
    </style>    
    <link rel="stylesheet" type="text/css" href="css/dropdown.css"/>

        <script src="//ajax.googleapis.com/ajax/libs/dojo/1.11.2/dojo/dojo.js"></script>    
        <script>
        var dojoConfig = {      
            parseOnLoad: true
        }
        require([ 
       'dijit/layout/BorderContainer', 'dijit/layout/ContentPane', "dojo/parser", "dojo/domReady!" ],
       function(BorderContainer, ContentPane, parser) {
       parser.parse();
       });        
        </script>       
    </head>

    <body class="claro" style="font-family: Verdana; font-size: 11px;">          
    <div id="mainWindow" data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design:'headline',gutters:false" style="width:100%; height:100%;">             
        <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'top'">             
        <a id="linkDeRegreso" style="display:none;" href="#" class="controlesVolver"> &lt;&lt; Volver a p&aacute;gina anterior</a>    
        <div >
        <ul class="dbtul">
        <li class="dbtli"><a class="active" href="#home">Home</a></li>
        <li class="dbtli"><a href="#news">News</a></li>
        <li class="dropdown">
        <a href="#" class="dropbtn">123456</a>
        <div class="dropdown-content">
            <a href="#">Link 1</a>
            <a href="#">Link 2</a>
            <a href="#">Link 3</a>
        </div>
        </li>
    </ul>
        </div>
        </div>  
      </div>       
    </body>
</html>

Answer №1

The fixed height for the ContentPane div is determined by the BorderContainer layout. This particular div has the claro.css declarations for the dijitContentPane class:

.dijitContentPane {
    display: block;
    overflow: auto; 
    -webkit-overflow-scrolling: touch;
}

If you change the overflow to visible, your solution may work initially but could lead to layout issues when additional elements are added to the container. Consider using a dijit MenuBar as an alternative solution:

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Illuminate the <select> within the form at the bottom

I have experimented with various combinations of Bootstrap 4's flexbox align utilities, as outlined in their documentation, but to no avail. Is there a way to ensure that the second <select> in the form below is aligned at the bottom of the row ...

Variable width items inside an overflow-x container

I'm searching for a solution to create a vertical navigation list that can accommodate elements wider than the container itself. Since users have the freedom to input any names for the items, I cannot predict their width, except maybe by setting a ver ...

How to center an image and text vertically within a div

Struggling to vertically align an image and text in a parent div? Check out my code snippet below: Here's the link to my Fiddle: jsfiddle HTML Code Snippet: <div class="social-cont"> <div class="social-cont1"> <img src=" ...

The Bootstrap carousel is stuck and not moving

I'm really struggling to figure out why the bootstrap carousel code isn't working for me. It's frustrating because I followed the example on the bootstrap website and only made minor customizations, so it should be functioning properly. I su ...

Increase the size of a centered image within a table

Lately, I've felt like my mind is starting to unravel. Here's the issue at hand: I've been attempting to resize an image within a table cell so that it spans the full width of the cell. Strangely enough, this seems to be harder than anticip ...

What is the best way to position a search bar in the center of the navigation bar while still ensuring the webpage remains responsive?

Being new to the world of CSS and HTML, I am currently facing challenges while creating a webpage for my school project. Specifically, I am struggling with inserting a search bar in the middle of the navigation bar rather than on the left or right side. Al ...

CSS causing unexpected behavior in image slider

I am facing an issue with incorporating a code for an image slideshow into my website. The current CSS is causing the slideshow to malfunction. Without the slideshow code in the CSS, the image appears correctly on the screen and changes its source every 2 ...

Adding an event listener to stripe elements: A step-by-step guide

My attempts to attach an event listener to the close button in stripe checkout form (the default one) have been unsuccessful, as I keep getting the error message "Cannot read property 'addEventListener' of null". Here is the code snippet I am usi ...

"Stylish symbols displayed atop the bootstrap navigation bar

Looking to add some icons (Facebook, Instagram, YouTube, WhatsApp) above my navbar elements. Here is an example of what I'm trying to achieve: https://i.sstatic.net/Ojio6.png Below is the code I am currently using: <nav class="navbar fixed-top na ...

I am having trouble with Owl Carousel in my code. Can anyone help me figure out what is causing the issue

I'm having trouble getting my owl carousel to display when I try to run it. I've made sure to link the correct stylesheets and scripts, but nothing is showing up on the page. Even after trying to link the stylesheets from both a local source and ...

Bootstrap-4 grid system is effectively maintaining its responsiveness without collapsing

I'm struggling to display one image per row on smaller screens using the sm breakpoint. This is my first attempt at using bootstrap 4. I followed their grid system guidelines which stated that responsive breaks occur when specifying a size for each c ...

Narrowing the width of a line-broken <h1> heading

I have encountered a problem that can be best described with two images provided below. Let's focus on the relevant CSS snippet: h1 { display: inline-block; background-color: pink; } The first example shows an <h1> tag with a short ti ...

Unable to set the width for a div element within the bootstrap grid layout

When trying to set the width of a div tag to 100% within a bootstrap grid system (col-lg-3), I noticed that the div ends up taking the full width of the browser instead of just 100% of its parent(col-lg-3). .sidebar { color: #fff; f ...

`How can you indicate a clicked linkbutton from a group of linkbuttons in asp.net?`

There is a single aspx page with a set of link buttons on it. Link Button 1 Link Button 2 Link Button 3 Link Button 4 Link Button 5 When any of the link buttons are clicked, they should be highlighted. All these link buttons are contained within a table ...

Issue with tab focus causing dropdown menu to be unresponsive

I'm currently experimenting with a bootstrap example featuring a dropdown menu. Here is the live example: http://jsfiddle.net/p73vc8Lv/ My goal is to have the dropdown menu display when the user clicks on the link. I've attempted to achieve thi ...

Troubles with resizing background images in Google Chrome

I am currently working on the development of this website: The site is nearly complete, but I am facing some issues with the resizing of two background images. While it works perfectly on Firefox, the second background (text background) is not resizing co ...

Necessary Quasar Select Dropdown Class

Looking to set an asterisk (*) next to the Select component in Quasar when it is marked as "required". While I can achieve this with the input component, replicating the same behavior for dropdowns has proved challenging. I attempted using the :deep selec ...

Fade transition for background image position in CSS3

I'm working on a unique sprite image to control my slideshow. My goal is to make the controls appear active by changing the background position when a user hovers over them. To achieve this, I've implemented the following CSS transitions: -moz ...

Adjusting the margins of jQuery mobile buttons

I seem to be stuck on a simple error that is causing me to spin my wheels. Take a look at the following jqm (version 1.3) view (in haml) #main-header{'data-role' => 'header'} #main-content{'data-role' => 'content ...

Transitioning to mobile-friendly web design

Just completed my very first page for a personal portfolio website. As a novice in web development, I made the width of my site 1600px to match the background image. Now, my goal is to make the page responsive. However, when I adjusted the width to 100%, ...