CSS: Overflow property of container causing dropdown menu to be hidden

Currently, I am working on a sizable project with extensive code, which restricts me from modifying the HTML structure of the table. However, I have the flexibility to adjust the CSS.
Many parts of the content are lengthy, and my goal is to enable horizontal scrolling for the .container if there is overflow in content.
The issue arises when changing the .container's overflow-x property to either auto or scroll, as it causes the dropdown menu triggered by the CLICK ME link to only display within the container's boundaries, clipping any content that extends beyond it. Is there a way to overcome this obstacle?

Link to CodePen Example

body {
  background-color: pink;
}
.container {
  margin-top:100px;
  height: 150px;
  width: 100%;
  background-color:grey;
  overflow-x: inherit;
  max-height: 150px;
}


td {
  font-size: 30px;
}

.foo {
  color: red;
}

.dropdown-menu{
  right:20px;
  top:-30px;
  position: absolute;
  z-index: 2147483549;
}

tr:nth-child(1) td .dropdown-menu {
  top: -30px !important;
}

tr:nth-last-child(-n+2) td .dropdown-menu{
  top: -165px;
}
a.dropdown-toggle {
  position: absolute;
  z-index: 999;
  right: 20px;
}
.open > .dropdown-toggle.btn-bitbucket {
  color: #ffffff;
  background-color: #163758;
  border-color: rgba(0, 0, 0, 0.2);
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.5/umd/popper.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0/js/bootstrap.bundle.js"></script>


<div class="container">
  <table>
     <td>
      Option1
    </td>
     <td class="foo">
      CLICK
        <div class="dropdown">
          <a href="#" class="dropdown-toggle" id="options" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
            .....
        </a>
        <ul class="dropdown-menu pull-right" aria-labelledby="options">
            <li><a href="/admin/orders" class="link">Associated Orders</a></li>
            <li><a href="/admin/items" class="link">Associated Items</a></li>
            <li><a href="/admin/colors" class="link">Associated Colors</a></li>
            <li><a href="/admin/waitlist/by-customer" class="link">Associated Lists</a></li>
            <li><a href="/admin/shopping-cart" class="link">Associated Carts</a></li>      
            <li><a href="/admin/waitlist/others" class="link">Others</a></li>
            <li><a href="/admin/waitlist/account" class="link">Account</a></li>
        </ul>
    </div>
    </td>
     <td>
      Option3
    </td>
     <td>
      Option4
    </td>
    <td>
      Option5
    </td>
     <td>
      Option6
    </td>
    <td>
      Option7
    </td>
     <td>
     Option8
    </td>
     <td>
     Optio9
    </td>
     <td>
      Option10
    </td>
    <td>
      Option11
    </td>
     <td>
      Option12
    </td>
    <td>
      Option13
    </td>
     <td>
      Option14
    </td>    
  </table>
  
</div>

https://i.sstatic.net/oD2Qf.png

Answer №1

Hello, I'm not entirely sure what you're looking for. I've created a solution below that may help, but please let me know if it doesn't solve your issues. Feel free to adjust the following CSS code and give it a try. Thank you, and apologies if it doesn't meet your expectations.

.container {
  margin-top:100px;
  height: 150px;
  width: 100%;
  background-color:grey;
  overflow-x: auto;
  max-height: 150px;
}
td {
  font-size: 30px;
  vertical-align:top;
}
tr:nth-child(1) td .dropdown-menu {
  top: 0 !important;
}
.dropdown-menu{
  right:20px;
  top:0;
  position: relative !important;
  z-index: 2147483549;
  transform: none !important;
}

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

Incorporate the HTML CTA on top of the background image within the email template

In my email template, I am trying to place an HTML CTA over a background image. The code works perfectly on all email clients including mobile and desktop, except for Outlook where the alignment of the CTA copy is off. Below is the code snippet along with ...

What is the best way to display information from mySql in a Bootstrap table?

Recently, I've delved into using VB.NET and ASPX to manipulate data from my database within a bootstrap table. Below is the code for a static table, but what I really need help with is dynamically populating it with values from the database. <div ...

Rotating Images in Query and Chrome

My script for rotating images is functioning well in various browsers, however, it seems to be experiencing issues specifically with Google Chrome. In order to address this problem, I attempted a CSS3 workaround. Unfortunately, I have encountered difficul ...

Hovering over overlapping spans without moving them

For the text formatting, I attempted to use the following code: <style> #items { width:400px; padding: 10px; } .esp { float: left; background-color: yellow; position:relative; z-index:0; } .le { float: left; position:rela ...

Pause the YouTube video and swap it out with an image

I am currently working on incorporating an embedded YouTube video into my project. I want to replace the video with an image, and when the image is clicked, the video should start playing. I have successfully implemented this functionality: <script typ ...

Another option instead of using `overflow: hidden` that won't cut off part of a character

My calculator display limits the numbers shown using the CSS property overflow: hidden. However, I don't want it to clip characters in half, which is currently happening. Mozilla suggests using text-overflow: '';, but this isn't widely ...

Is there a way to retrieve text from within a div using code behind in asp.net with c#?

I am currently developing a SQL QUERY editor where users can enter queries. The entered text is then passed to a SQL COMMAND for execution, and the results are displayed to the user in a GRIDVIEW. However, I am facing an issue in retrieving the text entere ...

Ebook document featuring a dual-column layout

Seeking recommendations for EPUB files that contain two columns. I'm struggling to implement two columns in my CSS file. ...

Scraping the web for dynamic data with the power of R

I am facing a challenge in retrieving the average user rating from an Indian movie Hindi review page on Times of India. The code I have written seems to be unable to fetch the desired data, which I suspect is due to the dynamic loading nature of the conten ...

Steps on how to trigger an onmouseover event for entire blocks of text:

I'm currently in search of an onmouseover code that seems to be elusive on the vast internet. A CSS box format has been successfully created: .box { float: left; width: 740px; height: 300px; margin-left: 10px; margin-top: 10px; padding: 5px; border: ...

Setting a minimum height for bars on a graph can be achieved by adjusting the

I need assistance with my graph display. Currently, the graphs are not showing when the value is less than a certain point. I would like to set a minimum height so that they can be displayed regardless of the value. My graphs are being generated using cha ...

Selecting a filter for an array of objects

I'm struggling to implement a search feature in my mat-select DropDown. The existing options I've found online aren't quite working for me due to the object array I am passing to the Dropdown. Any assistance or guidance on this matter would ...

The HR tag does not display anything following the mailing

Struggling to design a newsletter template with different lines for each product using the HR tag. However, none of my attempts with divs, tables, or CSS properties have been successful. The template looks fine in Chrome, but when sent to the provider, th ...

What causes the Bootstrap 4 Beta .invalid-feedback to show up even when the field is valid?

I am experiencing an issue with a form that is using Bootstrap 4 beta for form validation. Everything seems to be working as expected except for the invalid-feedback class. Initially, the feedback div is displayed correctly like this: https://i.sstatic.ne ...

The content's div is not extending completely in the horizontal direction

Just starting out with tailwind CSS and struggling a bit with the design aspect due to my lack of CSS skills. Need some assistance troubleshooting my layout, particularly in making sure the div container stretches to fit the screen size properly. https:// ...

"Create a CSS rule to draw a horizontal line on the one side of

Is there a way to create a horizontal line on just the left side of my text? Currently, the code I have creates a line on both sides. How can I modify it to achieve this? h2 { width: 100%; text-align: center; border-left: 1px solid #000; // Adjusted ...

Borders are absent on several div elements

There is a strange issue I'm facing where some borders on identical divs are not showing up. I have spent hours trying to troubleshoot this problem, and it seems like zooming in or out sometimes makes the border appear or disappear. My hunch is that i ...

Can someone help clear up this confusion with CSS?

Why is image 6.png selected, when all the images are direct descendants of the div shape? Thank you for your assistance, it's greatly appreciated. As far as I know, it should select all the divs because they are all direct descendants of the div #shap ...

Clicking on the search bar in front of the background image will take you back to the homepage

The issue I am facing is with my header image that contains a search field. Whenever I click on the search input, it redirects me to the homepage because the search functionality is embedded within the <section> tag. I'm looking for a solution ...

The custom width is not being applied to the Bootstrap column

I'm working on a Web Design project using Bootstrap. Here is a snippet of my HTML code: <div class="col utility_col"> <div class="row"> <div class="col vote_col">Vote</div> <div class="col sign_col"> < ...