Tips for maintaining a div's visibility on hover while also having space between (by adjusting opacity)

Need help with keeping the space between a button and popup in CSS. The opacity property is sometimes not working as expected. Any tips on how to solve this? Check out the code here

<div class="timer-container">
  test
</div>

<div class="auto-update-container">
  <span class="active" title="Refresh every 10 seconds">10s</span>
  <span title="Refresh every 30 seconds">30s</span>
  <span title="Refresh every minute">1m</span>
  <span title="Refresh every 5 minutes">5m</span>
  <span title="Refresh every 15 minutes">15m</span>
</div>
.map-toggles {
  background-color: #fff;
  border-radius: 2px;
  bottom: 36px;
  display: flex;
  flex-direction: column-reverse;
  left: 17px;
  max-height: 42px;
  overflow: hidden;
  position: absolute;
  transition: all 200ms linear;
  z-index: 1;

  &.open,
  &:hover {
    max-height: 600px;
    overflow: visible;
    box-shadow: 2px 5px 16px rgba(51, 51, 51, 0.2) !important;
    border-radius: 7px;
  }

  .toggle {
    align-items: center;
    color: #465b67;
    cursor: pointer;
    display: flex;
    flex: 0 0 auto;
    font-size: 24px;
    height: 42px;
    justify-content: center;
    position: relative;
    width: 42px;

    &.off {
      background-color: #495054;
      color: #869096;

      background-color: transparent;
      color: #c3d4de;
    }

    &.disabled {
      box-shadow: none !important;

      &::after {
        content: '';
        width: 3px;
        height: 30px;
        transform: rotate(45deg);
        background-color: rgb(212, 87, 87);
        position: absolute;
      }
    }

  }

  .toggle-autoupdate {

    .auto-update-container {
      align-items: center;
      background-color: #fff;
      display: flex;
      flex-wrap: wrap;
      height: auto;
      justify-content: center;
      left: 42px;
      opacity: 0;
      position: absolute;
      pointer-events: none;
      top: 0;
      transition: all 200ms linear;
      width: 70px;
      background: #fff;
      margin-left: 10px;
      box-shadow: 2px 5px 16px rgba(51, 51, 51, 0.2);
      border-radius: 7px;

      >span {
        align-items: center;
        display: flex;
        font-size: 1rem;
        height: 42px;
        justify-content: center;
        width: 100%;

        &:hover {
          background-color: #456994;
          color: #fff;
          box-shadow: none !important;
        }

        &.active {
          color: #fff;
          background-color: #456994;
        }
      }
    }

    &:hover {
      >.auto-update-container {
        opacity: 1;
        pointer-events: all;
      }
    }

    &.disabled {
      &:hover {
        >.auto-update-container {
          opacity: 0;
          pointer-events: none;
        }
      }
    }
  }
}


.autoupdatediv {
  margin-top: 100px;
  bottom: auto;
  top: 36px;
  left: 20px;
  padding: 1px;
}

Answer №1

To make this class function properly, all you need to do is include some padding.

.timer-container {padding: 10px 15px;}

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

Tap to smoothly scroll through each block using the animate() function

ul { padding: 0; margin: 0; height: 180px; overflow: auto; } li { height: 50px; background: pink; list-style: none; margin-bottom: 10px; height: 50px; ...

Is there a way to randomly change the colors of divs for a variable amount of time?

I have a unique idea for creating a dynamic four-square box that changes colors at random every time a button is clicked. The twist is, I want the colors to cycle randomly for up to 5 seconds before 3 out of 4 squares turn black and one square stops on a r ...

Minimize the gap between the input text and the lower border

Is there a way to bring the input text field and text closer together by reducing the space between the bottom border and the text? #a { padding: 1px 3px; background: transparent; border: 0; outline: 0; border-bottom: 0.8px soli ...

Utilizing different levels of `<div>` within the card-body component in Bootstrap5

While following a web application tutorial on YouTube, I encountered a question. The code snippet is shown below: <div class="card card-body"> ... </div> The resulting output is displayed in this image: https://i.sstatic.net/D3iBL.p ...

Tailwind CSS allows you to customize breakpoints and adjust the max-width of containers to suit

Having trouble with setting custom breakpoints in Tailwind CSS. I need to define specific screen sizes that are independent of the container widths. Is it possible to configure this within the Tailwind config file? My goal is to have the "screens" values ...

How to make Vuetify grid columns wrap and fill the full height

I am facing an issue where the component created using v-card in a grid system does not fill the full height. I tried using d-flex but it did not work as expected. The middle column with a white v-card should occupy the entire column height but it is gett ...

Bootstrap side navigation bars are an essential tool for creating

Is there a way to change the hamburger icon in Bootstrap's navbar-toggle to an X button? I want the side nav to slide to the left when clicked, and also collapse when clicking inside the red rectangle. Thank you. https://i.sstatic.net/nQMGs.png Code ...

Ways to style a div identifier within a div group

<div class="content"> <div class ="imgs"> <a href="#"><img src="images" alt="some_text" width="250" height="210"></a> </div> <div class = "compu"> <div id="titulo">text</br></div> ...

Updating the content within a div using HTML

I'm facing a challenge. It's not so much about how to do something, but rather how to do it better. What I'm aiming for Additionally, I want to dynamically load content into the page when clicking on navigation links. My query is what wou ...

Transferring data from an Excel spreadsheet into a structured table

I am interested in transferring specific columns of data from an excel sheet to an HTML table. My goal is to populate the table based on certain conditions rather than statically inputting fixed cells. For instance, if my excel sheet has columns for Name ...

Rearrange the location of the displayed pathway within a document feature

In the process of uploading an image on my website, I have utilized a file field. When I select an image by browsing, the path of the image is displayed in the field. However, in Internet Explorer (IE), the path shifts down making it difficult to read. H ...

A step-by-step guide to configuring layouts in AngularJS

I'm a newcomer to Angular JS with a screen layout that is split into 4 sections. <table> <tr> <td>Section 1</td> <td>Section 2</td> <td>Section 3</td> </tr> <tr> <td ...

How can I add an ellipsis to a title within a Material UI CardHeader?

Currently, I am utilizing the Material-UI library and facing an issue with applying ellipsis to the Typography component within the CardHeader. Despite trying to use noWrap in the titleTypographyProps, the expected behavior is not achieved. I wonder if th ...

Display div - conceal div - pause for 15 minutes - continue the cycle

I have a challenging JavaScript task that I've been struggling with for quite some time. The goal is to display a div for 5 seconds, hide it, wait for 15 minutes, then show it again for another 5 seconds, and continue this process in an infinite loop. ...

Having trouble running the npm script due to a multitude of errors popping up

I have encountered an issue while trying to run an npm script. I added the script in the `package.json` file multiple times, but it keeps showing errors. I am currently working on building a website and require npm sass for it. However, when I try to run t ...

Enhance your product listings in Opencart 2.0 by adding supplementary images alongside the main product image

Can someone assist me with moving additional product images next to the main product image in the default opencart 2.0.1.1 theme? Currently, they are appearing below the product image and I would like them to be displayed alongside it instead. ...

Creating a unique data attribute in Alpine.js - A step-by-step guide

I am looking to establish a custom attribute and modify the value when clicked. This is my current setup: <div x-data="{ colorred = true }"> <div @click="colorred = !colorred">set red state</div> </div> I ...

I created a new game where I can select two images to display, but for some reason, it is only showing one

My rock paper scissors game functions well, except for one issue. I programmed it to display both the player's choice and the bot's choice along with an outcome message (win, tie, or lose). However, I encountered a problem where only the player&a ...

In AngularJS, the process of replacing text using a filter can be achieved by following

Currently in the process of learning Angular, but I've hit a roadblock and can't seem to find a solution. I have a website that provides USPS shipping options, and I need to replace the default text with my own. The vendor's option shows &ap ...

Checkbox selection and display: Check the box to reveal its value in a div, along with a close button for

While following a tutorial, I came across a scenario where multiple checkboxes are involved. Upon selecting the checkbox and clicking on the "get selected value" button, the value of the selected checkboxes is alerted. However, I would like to make a mod ...