Individually hover over each section with CSS effects

Hey there, I'm trying to create something similar to this:

photo

using divs and css. I need to make each area hover separately. So far, I've attempted the following code, but it's not working as expected because it only activates two blocks ;/ css:

 <style type="text/css">


    .arrow-up {

      position : absolute;
      top : 150px;
      width: 150px; 
        height: 0; 
        border-left: 60px solid transparent;
        border-right: 60px solid transparent;
        border-bottom: 60px solid black;
    }
  .arrow-up:hover{
    border-bottom: 60px solid red;
}

    .arrow-down {
       position : absolute;
      top : 90px;  
      width: 150px; 
        height: 0; 
        border-left: 60px solid transparent;
        border-right: 60px solid transparent;

        border-top: 60px solid blueviolet;
    }
    .arrow-down:hover{
    border-top: 60px solid red;
    }
    .arrow-right {
        position : absolute;
       top : 90px;
      width: 0; 
        height: 0; 
        border-top: 60px solid transparent;
        border-bottom: 60px solid transparent;

        border-left: 60px solid green;
    }
    .arrow-right:hover{
    border-left: 60px solid red;
    }

    .arrow-left {
        position : absolute;
       top : 90px;
      left : 217px;
      width: 0; 
        height: 0; 
        border-top: 60px solid transparent;
        border-bottom: 60px solid transparent; 
        border-right:60px solid blue; 
    }

    .arrow-left:hover{
    border-right: 60px solid red;
    }
</style>

<html>
    <body>
       <div class="arrow-down"></div>
      <div class="arrow-up"></div>

    <div class="arrow-left"></div>
    <div class="arrow-right"></div>

    </body>
</html>

Any suggestions or ideas? Is it even possible?

Check out the demo here

Answer №1

Yes, it appears to be in good shape. I recommend removing the div:hover selector and utilizing your classes to target elements when they are hovered over. For example:

.arrow-up:hover{
    border-bottom: 60px solid red;
}

This code will now change the color of the border to red on hover. Hopefully, this resolves the issue.

Your current positioning is as follows:

.arrowBox{
    display:inline-block;
    width:24%;
    //for ie 5.5 to 7 
    float:left;
}

Regarding the HTML structure:

<div class="arrowBox">
<!-- arrows go in here -->

</div>

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 determine the number of subchildren within a parent div using JavaScript or jQuery?

Can anyone assist me with counting the number of child divs inside a parent div using JavaScript or jQuery? I'm not very experienced in these languages. Below is my code snippet: $(function () { var parent = document.getElementById('parent& ...

Forming a ring around a character within a header one element

I am faced with the challenge of only circling a single letter within a word that is contained in an H1 tag. While creating a circle around text is easy, I specifically need to target just one letter: .large { font-size: 5em; } .circle { border-rad ...

The progress bar on my browser disappears when I click a link in my Next.js (React) application

I'm currently working on an app that uses Strapi as the backend and Next.js as the frontend. In my frontend, I have multiple links that are styled in a certain way. However, when I click on these links, there is a delay of about 2 seconds before the ...

Fixed position does not adjust based on the screen resolution

If I were to create a web page, I would include a main menu that always remains on the screen, similar to this design: https://i.sstatic.net/I57Xk.png There are no issues with screen resolution exceeding 1300px, as seen in the image above. However, when ...

Use jQuery to set the onclick attribute for all elements rather than relying on inline JavaScript

I am currently facing a challenge with converting inline JS to jQuery. My goal is to eliminate all inline onclick events and instead target them by class. HTML - checkbox <td class="center"> <?php if ($product['selected']) { ?> ...

Tips for resolving the issue of cypress automatically opening a new tab

Recently, I've encountered an issue while using Cypress to perform a test on my website. Every time I click on a button, it redirects me to a new tab, disrupting the flow of my test with Cypress. Despite trying to remove the "target" attribute using t ...

Ways to adjust the position of a DIV based on its index value

I'm currently working on a unique project that involves creating a triangular grid using HTML and CSS. The challenge I am facing is offsetting each triangle in the grid to the left by increasing amounts so they fit seamlessly next to one another. Righ ...

There was a problem accessing the website

Recently, I tried to access a web page from the server using command prompt by following a tutorial on YouTube. However, I encountered an error message while trying to open the page. The specific error is displayed below. Can someone please guide me on res ...

Tips on inline password field placement for a better user interface experience?

While creating a registration form, I ran into a user interface problem. There are two specific changes I'd like to make: The label for Confirm Password should be inline on the same line. The password input should have an eye icon embedded within it ...

Tips for successfully passing arguments in Angular applications

I've encountered an issue while working with mat-autocomplete. My function is not functioning properly when I select an item from the drop-down list. It seems like I need to pass the add() function in my select, but I'm receiving an error stating ...

Center-aligned footer with a sleek right border in Bootstrap 4.1.1

Presenting my design concept for the footer: https://i.sstatic.net/kxdXJ.png Here is the code snippet for the footer design utilizing Bootstrap 4.1.1: .mainfooter-area { background: #404044; padding: 100px 0; } ... <link href="https://cdnjs.cl ...

Does the width of a div with an absolute position rely on the width of its parent element?

Is it possible to have a div with absolute position adjust its width based on its content rather than its parent's width? For example, <div style="position:absolute"> <div style="position:absolute"> <div style="position:absolute"> ...

Every time a new message is sent or received, I am automatically brought back to the top of the screen on the

I'm currently working on integrating a chat feature into my Angular Firestore and Firebase app. Everything seems to be functioning well, except for one issue - whenever a new message is sent or received, the screen automatically scrolls up and gets st ...

Tips for utilizing the grid system in Bootstrap 4 to transform a dropdown menu into the desired shape shown in the image

I am struggling to create a dropdown menu similar to the one highlighted with a red border in the image, The screenshot I referenced is from the bootswatch website (a bootstrap theme). Although I attempted to use bootstrap flex utility, I was unable to a ...

Unending horizontal flow of divs inside a container div

I have been experimenting with creating a continuous strip of logos that display customer quotes when selected. I have successfully implemented functionality for selecting and displaying the logos and quotes. However, I am facing an issue with making the l ...

How can I set the end date value in JQuery datepicker to be empty

Solution: <html> <head> <script type="text/javascript"> $(function(){ $("#datepicker1").datepicker({ dateFormat: 'dd-mm-yy', onSelect: function(selected){ $("#datepicker2").datepicker("option" ...

Use jQuery to retrieve the response from a JSON request and showcase it on the existing HTML page

Currently, I am working on a project that involves integrating a JSON-based web service from a remote server. The method of this service can be accessed by using specially formatted URLs such as: http://root-url/ws/service-name?request={json-string} The ...

The Ajax request is successful on one server but fails on another

I have implemented an ajax call to the UPS address validation webservice. The call is successful when made from my application using this domain: http://serverone.org/addrvalidator. However, if I try using a different domain or an IP address instead of th ...

Links arranged in semicircles along the perimeter of the page

Here is some code that I have created to display two links in circles positioned on the left and right sides of a webpage. [class*="navigation"] .nav-previous, [class*="navigation"] .nav-next { position: fixed; z-index: 999; top: 50%; text-align ...

tips for maintaining text size without affecting the layout of surrounding elements

https://i.sstatic.net/xQLFr.png I need to align the content of two divs in the same location, but the length of text in the first div is affecting the positioning of the body content. This is causing the two divs to look different. I want the body content ...