Designing image hover effects using CSS

I am looking for guidance on how to achieve a similar effect to the one shown here:

Specifically, I want to create a box with images that appears below a button when the user hovers over it.

The box should remain visible as long as the user's mouse is on either the box or the button.

Currently, my code is functioning but lacks the inclusion of images:

http://jsfiddle.net/6LUnV/1/

CSS

.tooltip{
    position: relative;
}

.tooltip:hover:after{
    background: #000000;
    top: 30px;
    color: #FFFFFF;
    padding: 10px 10px;
    content: attr(id);
    left: -90px;
    position: absolute;
    z-index: 98;
    width: 200px;
}

HTML

<button class="tooltip" id="Select an image<img src='a.png'/><img src='b.png'/><img src='c.png'/><img src='d.png'/>" style="margin-left:160px;">Select</button>

EDIT: Updated Question

Answer №1

Can you style a div like this using CSS?

<style>

#select {position: relative; width: 80px; margin: 0 auto;}
button {width: 80px;}

#images {overflow: hidden; position: absolute; bottom: -50px; left: 50%; margin-left: -100px; width: 200px; display: none;}
img {float: left; width: 50px; height: 50px;}
img {background: red;}
img:nth-child(2) {background: green;}
img:nth-child(3) {background: blue;}
img:nth-child(4) {background: yellow;}

#select:hover #images {display: block;}

</style>

<div id="select">
    <button>select</button>

    <div id="images">
        <img>
        <img>
        <img>
        <img>
    </div>
</div>

Check out the code snippet here!

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

Is there a problem with the Drag and Drop API?

So here's the deal: I've encountered a problem with the HTML5 Drag and Drop API. In short, besides the essential dragstart, dragover, and drop events, there are three more events - mousedown, mouseup, and mouseleave - that are crucial for achiev ...

Invalid Value Provided for CSS Clip Path

I'm currently attempting to design a sophisticated clip-path using a logo in CSS, but I keep receiving an error stating "Invalid Property Value." The X and Y coordinates have been computed based on dimensions of 508px x 190px https://i.sstatic.net/Yh ...

Saving and restoring the cursor/caret position in CKEditor 4: A how-to guide

While browsing similar questions on this topic, I realized that none of them really addressed my specific issue (or maybe I just need a better understanding of the concept). Initially, I embarked on the journey to acquire and manipulate the caret position ...

Tips for efficiently obtaining JSON Ajax data, saving it to local storage, and presenting it in a jQuery Mobile list view

Upon calling ajax to my server, I receive 1000 units of data which I then store in my local storage before displaying it on a jQuery mobile list-view. However, this process takes around 50-60 seconds to complete. Is there a way to optimize this and make it ...

Adjust the height of a responsive div to match its adjacent element

Two of my divs are set to specific widths using percentages. I'm looking for a way to make the right div match the height of the left div, which changes based on the dimensions of an image and the browser window size. Is there a method to achieve this ...

Not all the divs nested within the main div are having the class applied to them

Here is the HTML code I have: <?php require_once("../RMS/php/component.php") ?> <!DOCTYPE html> <html lang="en"> <head> <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-prot ...

Count of elements in one flexbox row

Having a flexbox container with multiple items in row-wrap format, is there a way to use JavaScript to determine the number of items in each row? Essentially, finding out at what point they wrap. For instance- <div class="container"> <div clas ...

The functionality of filtering a list based on the selected value from a drop-down menu is malfunctioning

When the page initially loads, there is a dropdown with the default placeholder "Select Person Type" and a checkbox list displaying all persons by default. An angular filter is used to display only the selected type of persons from the dropdown (working p ...

Ensure Website Accessibility by Implementing Minimum Resolution Requirements

Is it possible to create a website that only opens on screens with a resolution of at least 1024 x 768, and displays an error message on unsupported resolutions? I've tried using JavaScript to achieve this, but haven't had any success. Any assis ...

Is it possible to apply varying CSS styles depending on the parent element's class?

Apologies for the poorly worded question, but I am struggling to find the right terms to convey my query. Let me attempt to explain... Is it feasible to apply different css styles based on the classes assigned to the containing element? For example: < ...

What steps can be taken to turn this html code and css into a mobile application?

I have begun working on my HTML and CSS but need some guidance to create a mobile app without needing to resize it when accessed through the web. Additionally, I would like to make it responsive in CSS. Can you provide me with the necessary code? @c ...

Creating a corner ribbon for a Material UI Card: A step-by-step guide

Can anyone provide pointers on incorporating a corner ribbon to a Material-UI card? Currently, I am utilizing makeStyles for styling from Material UI. ...

When you hover over the Dropdown Menu, the Hoverable Dropdown Menu will automatically close

I am currently working on creating a dropdown menu that pops up when hovering over an item. However, I am facing two challenges: Once my mouse moves away from the item, the dropdown disappears. Therefore, I would like the dropdown to remain visible as lo ...

How can you retrieve script data within HTML and PHP tags?

I am currently working on a web application using CodeIgniter-3 and I have encountered an issue with a form that contains two dropdowns which are dependent on each other. When a selection is made in the first dropdown, the data in the second dropdown sho ...

Discovering the dimensions of a disabled attribute within a table using XPath in Selenium with Java

I'm attempting to determine the number of columns in a specific table, but some are disabled - I'd like to know if it's possible to get the count without including the disabled ones (only counting the visible columns). As you can see in the ...

The confusion between <g:if> and <g:set> features in Grails is causing some issues

I am working with a gsp template that includes a variable. If this variable is true, I want to add an extra button; if it's false, nothing should happen. What could be causing my code to not work correctly? <g:set var="removeButton">{{ removeB ...

Can this PHP code be optimized for better efficiency?

Seeking to create dynamic links on a page where the link for the current page is excluded. The code functions as desired but seems repetitive - hoping for a more efficient solution, given limited programming experience. <div class= "links"> <?php ...

Space in the middle of a body and a div

After extensively searching for a solution to the issue plaguing my website, I found that there was always an annoying gap at the top of the page. Despite trying various solutions, none seemed to work. Upon inspecting the website in Firefox, I discovered t ...

Converting an HTML page into a JSON object by scraping it

Is there a way to convert an HTML page into a JSON object using web scraping? Here is the content of the page: <html><head><title>Index</title><meta charset="UTF-8"></head><body><div><p>[ <a href ...

Steps for creating a transparent Bootstrap navbar:1. Start by creating

I have Bootstrap HTML code for a navbar <!--Navbar--> <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> <img class="logo" alt="Brand" src="images/1.png"> <a class="navbar-brand" href="Homepage.jsp">Car ...