What is the best method for ensuring that a hover dropdown remains active when clicked on?

Trying to create a drop-down menu with overflow options that extend into the next section upon hover. The goal is for users to be able to click on "Join Now" or "Learn More," but currently, the buttons disappear when moving down.

HTML Code:

<div class="partner-boxes">
<div class="partner-box green">
            <div class="partner-box-header text-uppercase">
                New<br /> Partners
            </div>
            <div class="partner-buttons">
                <a href="#">Join Now</a>
                <a href="#">Learn More</a>
            </div>
        </div>

CSS Code:

.partner-boxes {
float: right;}

div.partner-box {
float: left;
position: relative;
.partner-box-header {
    font-size: 28px;
    font-weight: bold;
    padding: 22px;
    line-height: 24px;
    margin: 0 0 -52px;
}
&.green .partner-box-header {
    background: rgba(108, 192, 74, .65);
}
a {
    border: 1px solid #fff;
    color: #fff;
    display: block;
    font-size: 16px;
    margin: 9px 0;
    padding: 9px 0;
    text-align: center;
}
.partner-buttons {
    padding: 13px 22px;
    display: none;
    width: 100%;
    z-index: 1;
    position: absolute;
    top: 92px;
    min-height: 140px;
    a:hover {
        text-decoration: none;
        background-color: rgba(255, 255, 255, .1);
    }
}
&:hover {
    .partner-buttons {
        display: block;
    }
}
&.green .partner-buttons {
    background: rgba(108, 192, 74, 1);
}
&.light-blue .partner-buttons {
    background: rgba(79, 193, 224, 1);
}

... (CSS continues)

https://i.sstatic.net/306jz.png

Struggling to keep hover items visible without disrupting the design. Any suggestions?

Answer №1

Revamped this section:

.partner-buttons {
    padding: 13px 22px;
    display: none;
    width: 100%;
    z-index: 2;
    position: absolute;
    top: 69px;
    min-height: 140px;
    a:hover {
        text-decoration: none;
        background-color: rgba(255, 255, 255, .1);
    }
}
&:hover {
    .partner-buttons {
        display: block;
    }

To resolve the issue, I adjusted the top spacing from 92 to 69px to eliminate the gap.

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

spacing issue on webpage that appears only in mozilla browser

Recently, I started a new project for my clan. Initially, I was coding in Chrome without any issues. However, one of my friends pointed out a strange problem with the layout when viewed in Mozilla. There seems to be a white space at the top of the page, ...

Collapsed on Load Vertical Collapsible Panel - Initially hidden panel on page load

Is there a way to load a <div> already collapsed when the page first loads? You can find my progress so far in this JS Fidle. HTML <button id="aa">Toggle it up</button> <div id="test">TEST</div> CSS div { background ...

Adding a border to the input field in Bootstrap for enhanced styling and visibility

Looking to replicate the border style on an input element as shown in this image: https://i.sstatic.net/a2iwZ.png The current code I have is producing a different result. Can anyone assist me in achieving the desired border style? <!DOCTYPE html> ...

Tracking the number of images and adjusting the counter as the user scrolls

I am working on a project where I have a series of images displayed in a column. I would like to add a dynamic counter to indicate which image is currently in focus based on the scroll position. Feel free to check out the demo <div class="counter"> ...

What is the process for incorporating links into Google GeoChart maps?

I'm currently working on developing a unique clickable map using Google's GeoChart for a website. My goal is to make each country clickable so that users can be directed to separate web pages when they select different countries on the map. Addit ...

Although HTML and CSS files may be similar, the way in which styles are implemented can vary greatly from one

Working on a project locally, I noticed different styling on one element between two repositories. Despite the HTML, CSS, and JS files being identical according to WinMerge, there's an inconsistency with the bootstrap class card-img-overlay. The issue ...

What is the title of a document that is linked behind an HTML link?

I am seeking a way to automatically retrieve documents from web pages using a Python script. The links in the HTML pages appear as follows: href="https://foo.bar/view.php?id=123456" When clicked on in a web browser, these links open the document with its ...

Having trouble displaying image using absolute path in Express

Currently, I am developing a NodeJS application and have encountered an issue with a div element that has a background-image set in an external CSS file. Surprisingly, the CSS file functions perfectly when tested independently, and the background image dis ...

Can you provide me with information on how to indicate the activated menu item by highlighting the triggering button in Angular 14 and Material Design?

Is there a way to highlight the triggering button in an Angular Material menu, while also highlighting a menu item that matches a routerLink? <button mat-button [matMenuTriggerFor]="animals">Animal index</button> <mat-menu #animals ...

Extract the content from the division and set it as the image source

Looking for a way to retrieve the content from a div and insert that into the 'src' parameter of an image. Working on a project where JSON is used to load translation files, preventing me from loading images directly, but I want to at least load ...

I'm looking to make some adjustments to my export button (btnExport) in C# - what changes can I

This is the code I wrote for a basic program that exports data from a Datatable to a CSV file. The program functions as a website used to manage a database and convert it into a .csv file with the click of an export button. using System; using System.Coll ...

Can you reveal a table with the click of a button?

Hi there! I'm a newcomer to the world of Ruby on Rails and I’m currently working on creating a page that includes a date field. Once a specific date is selected, I’d like to generate a table displaying reports from that chosen date. controllers/r ...

choosing from dropdown menu items

Learn HTML <table> <tr> <td>ENTER PRINCIPLE AMOUNT</td> <td><input type="text" name="principle" size="7"></td> </tr> <tr> <td>ENTER RATE OF INTEREST</td> <td><input type="text" na ...

What is the best way to prompt users to submit comments with a popup textarea box?

Within my project, I have incorporated a dropdown list: <div class="dropdown"> <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Select subject <span class="caret"></span> </but ...

Adjust the message background color once it has been viewed

One of the buttons attached to a mat-menu has a red background when clicked. If you want to see it in action, check out this Stackblitz. .list-item.error { background-color:#FCE8FF; } However, if the button is clicked more than two times, the color sh ...

Enter text into a field on a different webpage and verify if the output matches the expected result

Possible Duplicate: Exploring ways to bypass the same-origin policy I'm facing a scenario where I have a form on my website that requires validation of a number. The validation process involves checking this number against another website where e ...

Is it possible to highlight and copy text while using OrbitControls?

As I work on my Three.js project with OrbitControls.js, I've come across an issue where I am unable to select or highlight any text using OrbitControls. For example, you can try visiting this link: (try selecting the text "orbit control example" at ...

Why do my navigation bar items in Bootstrap get highlighted in blue and underlined?

<!Doctype html> <html> <head> <meta charset="utf-8"> <title>IBAE-Information Library</title> <link rel="stylesheet" href="/Users/jeevabharathi/Desktop/Project.css"> <script sr ...

Align several labels and text areas in the center

I am facing an issue with aligning multiple labels and textareas together. Currently, they line up like this: __________________ | | | | Label:|__________________| However, I want them to appear as fol ...

What is causing the issue with my CSS keyframe animation not functioning correctly when using `animation-direction: reverse`?

Exploring the use of animation-direction: reverse to streamline my CSS keyframe animation process. An interesting scenario arises when a container div is clicked, toggling an "active" class using jQuery to trigger the animation in either forward or backwar ...