Nested dropdown within a parent container with scrollable overflow

As part of a project, I am required to design a view where a drop-down menu is positioned at the bottom of a parent div. You can see an example here: http://jsfiddle.net/Gruck/6owhaa63/. The "move to" item expands to show more options, similar to the mockup displayed in this image https://i.sstatic.net/HFGvm.png

  <div class="job">
    <div class="job-main">

      <div class="title">
        some content
      </div>
      <div class="counters">
        some other content

      </div>

    </div>
    <div class="ops">
      <ul>
        <li><a href="#">edit</a></li>
        <li><a href="#">visualize</a></li>
        <li><a href="#">move to</a>
          <ul class="move-to">
            <li>folder a</li>
            <li>folder b</li>
          </ul>
        </li>
      </ul>
    </div>
  </div>

Also, here's the CSS code:

.job {
  border-style: solid;
  border-color: #F2F2F2;
  border-width: 2px;
  background-color: #FFFFFF;
  overflow: auto;
}

.job-main {
  border-bottom: 1px solid #F2F2F2;
  overflow: hidden;
}

.title {
  width: calc(100% - 390px);
  height: 100px;
  float: left;
  min-width: 300px;
  padding:10px;

  background-color: #EE0000;
}

.counters {
  width: 362px;
  height: 80px;
  padding: 20px 0px 20px 0px;
  float: right;

  background-color: #00EE00;
}

I'm looking for suggestions on how to display these options on top of the parent div while still keeping them inside the div. Is there a way to achieve this without moving the options outside and manually positioning them? Any ideas are welcome!

Thank you in advance for any insights or solutions you may have :) Cheers

Answer №1

The best approach to keeping the content within the parent div is by adjusting its height so that all list items are visible.

However, if you decide to place it outside the parent div, the layout still appears correctly in the fiddle:

<div class="job">
  <div class="job-main">

    <div class="title">
      some content
    </div>
    <div class="counters">
      some other content

    </div>

  </div>

</div>
<div class="ops">
  <ul>
    <li><a href="#">edit</a></li>
    <li><a href="#">visualize</a></li>
    <li><a href="#">move to</a>
      <ul class="move-to">
        <li>folder a</li>
        <li>folder b</li>
      </ul>
    </li>
  </ul>
</div>

Fiddle: http://jsfiddle.net/6owhaa63/2/

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

What is the best way to transfer all li elements with a certain CSS style to a different ul?

I have a task to relocate all the <li style="display:none;"> elements that are currently nested under the <ul id="bob"> into another <ul id="cat">. During this relocation process, it is important that all the classes, ids, and CSS style ...

Ways to incorporate various styles on a mobile screen for a javascript-generated function

In my current project, I have implemented a JavaScript function that renders HTML within a module. function generateHTML(bankName) { let content = `<div class="bankName" style=""><strong style="font-size: 28px;font-wei ...

Guidelines for pinpointing local directories

Recently, I obtained a source code for a website navigation that includes a unique set of icons known as "Typicon." The HTML in the source code contains the following: <link rel="stylesheet" type="text/css" href="css/component.css" /> Within the C ...

HTML TABS: Make the first TAB automatically selected

I've been experimenting with tabbing in HTML using a tutorial I found on W3SCHOOLS. While the source code provided works fine, I'm encountering an issue with automatically selecting the first tab by default. The tutorial doesn't cover this, ...

Calculate the total of additional user inputs and show the result in a separate element using JavaScript

Query Is there a way for an element to dynamically show the total of different inputs? Situation I have multiple text boxes all with the same class. There are 4 input fields, each containing a number - Input 1 is "1", Input 2 is "2", and so on. The goal ...

Can you show me how to use vuejs to implement h2 tags?

Within the article, there are H2 tags that I want to use as a table of contents. However, despite attempting methods like Replace and substring, I haven't been able to isolate only the H2 tags from the content. The post content is structured in JSON f ...

What is the best way to remove a logo from a wordpress website?

I've come across a theme that I find quite appealing, but the "designed by" logo is positioned in a rather bothersome place - right in the center of the page on the left side. Is there a way for me to remove it from there and relocate it to the footer ...

Issues with Vertical Alignment and Navigation

Link: Please resize the browser to mobile view. Issue with Header: I am facing alignment issues in the header. The elements do not seem to be aligned properly at the center of the header. The Android logo is aligned, but the text and dash image are not. ...

Are there any plugins available that can create a Ken Burns effect using JQuery?

All I need is a straightforward plugin, not one for creating slideshows. In this case, I only have 1 div and 1 image. The goal is to have the image animate within the div, shifting left/right or up/down without any white space visible. The size of the ima ...

Looking for help with cURLing a specific URL

I am attempting to retrieve information from the following link: This link leads to a page that simply displays plain text. Here is the PHP cURL code I am utilizing: function get_web_page( $url ) { $user_agent='Mozilla/5.0 (Windows NT 6.1; rv:8. ...

Using jQuery Mobile to Recycle a Header and Navigation

I'm a beginner when it comes to jQuery Mobile and I'm struggling to grasp the concept of reusing headers and general navigation. Currently, I have a header with a menu button on the right. When the menu button is clicked, a popup shows up with l ...

A step-by-step guide to creating adorable rounded corners in a DIV element

I'd like to create a stylish rounded corner div on the top-right and top-left edges. I attempted it with the following code: border-top-left-radius: 5em; border-top-right-radius: 5em; Desired look of the div: https://i.stack.imgur.com/EoSvSm.jpg A ...

Issues with CSS functionality

Every now and then, this thing decides to work but most of the time it just doesn't. I have multiple tables in my application and the CSS is functioning properly for all of them. There's literally no difference with this one table, yet the CSS re ...

I am having trouble with Django Bootstrap when trying to center this container

I've been struggling to center this div container following my navbar in order to achieve equal spacing on both sides of the page. Unfortunately, my attempts have been unsuccessful. Could anyone provide assistance, please? The issue seems to be occurr ...

The iPhone is highly magnified on a webpage

I've been working on this issue for a while now but just can't seem to find a solution. The website appears to be zoomed in for some reason, and I'm struggling to identify the cause. Here is the meta tag I've been using: <meta name= ...

Submitting an HTML form with no input data

Looking to dynamically pass arguments between pages using the code below: <script type="text/javascript> function buildAndSubmitForm(index){ <? $args = 't='.$team.'&s='.$season.'&l='.$league.&apo ...

Bootstrap dropdown menu fails to expand

I recently attempted to implement a hamburger menu using Bootstrap on my website. After checking and adding the necessary CSS and JS files, I encountered an issue where the menu wasn't expanding as expected. I followed the example code provided on the ...

Display all event date markers, even if some dates are missing

Using the FullCalendar plugin has been a great experience for me. I have managed to successfully read data from a JSON object with the following code: function press1() { var employees = { events: [] }; ...

Disabling hover effects in Chart.js: A step-by-step guide

Is there a way to disable hover effects, hover options, and hover links on a chart using chart.js? Here is the code I have for setting up a pie chart: HTML.. <div id="canvas-holder" style="width:90%;"> <canvas id="chart-area" /> </div ...

What is the process for transforming specific words within a sentence into clickable links?

In my experience with React, I faced the challenge of creating links within a string. After experimenting with various approaches, I finally discovered a solution without having to manipulate the DOM directly. function generateProfile() { const hashtagRe ...