HTML and CSS hidden content on hover didn't works

0 favourites
  • 2 posts
From the Asset Store
_______ Huge collection of metal fixtures ________
  • Hey!

    I want to have a topbar navigation for my game, used for debug, with some menus inside.

    I have my HTML and CSS code working well when I test them in some simulator, but once I tried in game, everything is break, it seems that the hidden content didn't seems to works.

    Is it possible to fix this?

    My code :

    <!DOCTYPE html>
    <html lang="en">
    <head>
     <meta charset="UTF-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <title>Menu Déroulant</title>
     <link rel="stylesheet" href="styles.css">
    </head>
    <body>
     <div class="topnav">
     <a class="active" href="#home">Home</a>
     <a href="#news">News</a>
     
     <!-- Menu déroulant -->
     <div class="dropdown">
     <button class="dropbtn">Categories 
     <i class="fa fa-caret-down"></i>
     </button>
     <div class="dropdown-content">
     <a href="#cat1">Category 1</a>
     <a href="#cat2">Category 2</a>
     <a href="#cat3">Category 3</a>
     </div>
     </div>
     
     <a href="#contact">Contact</a>
     <a href="#about">About</a>
     </div>
    </body>
    </html>
    
    /* Add a black background color to the top navigation */
    .topnav {
     background-color: #333;
     overflow: hidden;
    }
    
    /* Style the links inside the navigation bar */
    .topnav a {
     float: left;
     color: #f2f2f2;
     text-align: center;
     padding: 14px 16px;
     text-decoration: none;
     font-size: 17px;
    }
    
    /* Style the dropdown button */
    .dropdown {
     float: left;
     overflow: hidden;
    }
    
    .dropdown .dropbtn {
     font-size: 17px; 
     border: none;
     outline: none;
     color: white;
     padding: 14px 16px;
     background-color: inherit;
     font-family: inherit;
     margin: 0;
    }
    
    /* Add a background color to dropdown links on hover */
    .dropdown-content {
     display: none;
     position: absolute;
     background-color: #f9f9f9;
     min-width: 160px;
     box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
     z-index: 1;
    }
    
    .dropdown-content a {
     float: none;
     color: black;
     padding: 12px 16px;
     text-decoration: none;
     display: block;
     text-align: left;
    }
    
    .dropdown-content a:hover {
     background-color: #ddd;
    }
    
    /* Show the dropdown menu on hover */
    .dropdown:hover .dropdown-content {
     display: block;
    }
    
    /* Change the color of links on hover */
    .topnav a:hover, .dropdown:hover .dropbtn {
     background-color: #ddd;
     color: black;
    }
    
    /* Add a color to the active/current link */
    .topnav a.active {
     background-color: #04AA6D;
     color: white;
    }
    
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It depends how you've added it to your project. The easiest way to get help is to share your project file.

    For example if you pasted all that HTML in to a HTML Element object, then it probably won't work, as the HTML is a full document, whereas the HTML Element is just one element inside an existing document. So things like the <html> and <head> tags probably won't work as expected.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)