CSS3 Breakdown: Hover No Longer Responding

I am currently in the process of learning coding, but I have encountered a problem that I cannot seem to solve. Initially, I had set the color for the hover effect, but somehow it disappeared and now I am struggling to bring it back. Please review my code below:

/* styles for the aside */
#aside1 {
    width: 180px;
    float: left;
    height: 350px;
    }
#nav_list ul {
    list-style-type: none;
    }
#nav_list ul li {
    align-content: left;
    width: 110px;
    margin-bottom: 0.5em;
    border: 2px solid black; 
}
#nav_list ul li a {
    display: block;
    padding: 0.5em;
    text-decoration: none;
    color: black;
    background-color: orange
}
#nav_list ul li a:hover, a:focus { color: green }

Answer №1

You may be experiencing an issue with the final line of your code. Keep in mind that when using vanilla CSS, you must specify a selector to target the :focus pseudo-class.

The correct syntax should be:

#nav_list ul li a:hover, #nav_list ul li a:focus { color: green }

As long as your HTML remains unchanged, this solution should work for you.

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

The canvas is being expanded by utilizing the drawImage method

Ensuring the correct size of a <canvas> element is crucial to prevent stretching, which can be achieved by setting the width and height attributes. Without any CSS applied other than background-color, I am faced with an unusual issue. Using ctx.draw ...

The dropdown menu I implemented is causing nearby HTML elements to be displaced downwards

I have a project where I added a dropdown menu to the navbar, but for some reason when toggled, it seems to push the HTML down. I've tried setting its position to absolute and top to 100%, but it didn't solve the issue. The project is built using ...

two adjacent DIV elements with matching heights

Currently, I am in the process of developing an internal web page with a wrapper DIV structure based on recommendations from an online tutorial. Within this wrapper, there are different sections including a header, mainnav, content, sidenav, and footer. Th ...

Displaying Bootstrap 4 dropdown menu on hover

I've noticed that the dropdown menus in Bootstrap 4 are triggered by click by default, but for some reason, my menu is appearing on hover without any additional CSS or JS. This poses a problem for mobile development. I could create a jQuery solution, ...

Bootstrap 4 has an enlarged input field when compared to the select input

I am facing an issue with the size of my select field, which appears larger than my two input fields in Bootstrap 4.3. Can anyone provide guidance on how to make the select field match the size of the input fields? Your assistance would be greatly apprecia ...

Shifting the Ion Menu side dynamically based on screen size: A step-by-step guide

Working with Ionic 4, I encountered the need to dynamically change the side property of ion-menu. On larger screens, ion-menu is always visible or static, whereas on smaller screens, it remains hidden until the user clicks on the ion-menu-button. My goal i ...

Having trouble setting a value as a variable? It seems like the selection process is not functioning properly

My Hangman game has different topics such as cities and animals. When a user selects a topic, the outcome should be a random item from that specific topic. For example: London for cities or Zebra for animals. Currently, I am only generating a random lett ...

"Use AJAX to dynamically update a div element when a button is clicked with a specific value

I have a calendar that is being displayed server side using PHP. My goal now is to allow users to scroll through the months with two buttons (<< / >>) without having to reload the entire page. I have come across many similar questions and examp ...

Changing the text color using jQuery is proving to be difficult for me

I've been trying to apply a styling condition using an if statement in my jQuery code based on the result from an API, but for some reason, I'm not seeing the color change. I have given an ID to try and change the color through CSS. $.getJSON(API ...

If the condition evaluates to true, then all other conditions will be skipped

xyz.html <p id = x ngClick = close($event)></p> <p id = y ngClick = close($event)></p> <p id = z ngClick = close($event)></p> <h1 id = a ngClick = close()></h1> xyz.js function close(event) if (event.targe ...

One column stretching all the way to the window's edge while the other column stays contained within its container

Looking to design a two-column layout where the left column takes up 40% of the container and aligns with it, while the right column expands all the way to the window edge. I managed to achieve this using position:absolute, but I'm curious if there&ap ...

What is the secret behind Facebook's ability to keep the chat bar fixed at the bottom of the browser window?

I am curious to learn about the method Facebook uses to keep the chat bar at the bottom of the browser window even when we scroll through the page. ...

Making Adjustments to the Padding of Main Content Column in Typo3 Using Bootstrap Package

As the administrator of our local sports club's homepage, I oversee svwalddorf.de, powered by typo3 10.4.22 with bootstrap package 11.0.3. The current bootstrap template creates excessive empty space around the centered content area as shown here. Th ...

Exploring the Intersection of Windows 8 Store Applications and jQuery: Leveraging MSApp.execUnsafeLocalFunction

Developing a Windows 8 JavaScript Store App (using Cordova) has led to some complications when using jQuery. It seems that in order to utilize certain functions, I have had to modify the jQuery library by adding: MSApp.execUnsafeLocalFunction While this ...

CSS Style in Safari does not conceal Div on Tailwind

When switching the screen from desktop to mobile in ReactJS/Tailwind, I have hidden certain images using the following code: <div className="flex shrink flex-row justify-between w-[60%] h-[25%] sm:w-[95%] sm:h-[52%] mb-[-10px] mt-[-15px] lg:mt-0&qu ...

Access the URL or link in an email using Chrome, as opposed to the default browser, IE8

I have an application that sends out an email with a URL link. When the link is clicked, it opens a new tab in the browser. Currently, the application works fine on Chrome but is not compatible with IE8. However, the client's machine has IE8 as the ...

Using JQuery to toggle a fixed div at the bottom causes all other divs to shift upwards

I'm currently working on a chat feature using node JS, and while the functionality is perfect, I've run into an issue with the CSS aspect of it. The problem arises when we have multiple tabs and clicking on just one causes all the tabs to move u ...

What causes the lower gap to be smaller than expected when using "top: 50%; translateY(-50%);" on specific elements within the parent container?

My top-bar layout needs to have all elements vertically centered, but I'm experiencing issues with the top-bar_right-part not behaving as expected when using the core_vertical-align class. The left menu works fine, however. To illustrate the problem, ...

Dynamic CSS gradients behaving unpredictably in Firefox

Greetings everyone, this is my first time reaching out for help here. I have added a nice gradient background to a page that uses ajax, and it works fine until the content gets lengthy after the call. When I view the page in IE (version 9), the gradient ...

Showcase a variety of random images in the navigation bar using Javascript and HTML

In order to create a unique experience for mobile users, I have implemented multiple images for my navigation bar menu icon toggle button. These images are stored in an array and a random image is selected each time the page loads using Math.Random. Howeve ...