stopping the current menu selection from altering its color

How can I stop the color change when hovering over the selected menu item? Here's my code:

<html>
    <head>
        <title> Another Page </title>
        <link rel="stylesheet" href="style4.css" type="text/css" />
    <head>

    <body>

        <div id="title">

            <ul>
                <li class="current"><a href="home.html">Home</a></li>
                <li><a href="content.html">Content</a></li>
                <li><a href="search.html">Search</a></li>
            </ul>

            <div id="clear">
            </div>

        </div>

        <div id="wrapper">

            <div id="header">


            </div>

        </div>

    </body>


</html>

And here's the corresponding CSS:

body
{
    padding: 0;
    margin: 0;
    background-color: rgb(24,205,20);
}

h1,h2,h3
{
    padding: 0;
    margin: 0;
}

p
{
    padding: 0;
    margin: 0;
}

.current
{
    background-color: black;

}


#title
{
    background-color: orange;   
}

#title ul
{

    list-style: none;
    padding: 0;
    margin: 0;
}

#title li
{
    float: left;
}

#title a
{
    text-transform: uppercase;
    text-align: center;
    text-decoration: none;
    display: block;
    width: 120px;
    font-weight: bold;
    color: #ffffff;
    padding: 4px;
}

#title a:hover
{
    background-color: rgb(180,138,18);
}

#clear
{
    clear: both;
}

I'm looking for urgent suggestions on how to fix this issue. Thank you.

Answer №1

To complete your CSS file, include the following line at the end:

#title .current a:hover {
        background-color: inherit;
}

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

Exploring the world of jQuery AJAX requests by sending POST data to a PHP

I am currently in the process of building a cross-platform application utilizing HTML, CSS, and jQuery/JavaScript. My approach involves using AJAX requests to retrieve data from a database and send data to it as well. I have successfully implemented the &a ...

Best practices for evenly distributing images within a navigation bar?

Within a horizontal navbar, I have various small images that are currently spaced out with different intervals between them. Each image has its own unique spacing from the others. I am looking to achieve consistent spacing between each image in this horiz ...

Using jQuery to append content with a variable as the source

Recently delving into jQuery and encountering an issue with getting my variable inside src when using append. Either it's not functional at all, or just displaying the variable name in string form in the console. Here is the code causing trouble: va ...

Guide on displaying a real-time "Last Refreshed" message on a webpage that automatically updates to show the time passed since the last API request

Hey all, I recently started my journey into web development and I'm working on a feature to display "Last Refreshed ago" on the webpage. I came across this website which inspired me. What I aim to achieve is to show text like "Last Refreshed 1 sec ago ...

Is it feasible to position an iFrame in the bottom right corner of the browser using CSS?

I'm trying to align an iFrame to the bottom right corner of the browser window using CSS. Initially, the following code seems to do the trick. However, if the page containing the iFrame has a horizontal scroll bar, the iFrame does not adjust its vert ...

I have come to realize that my understanding of how Sass nesting works was misguided

Currently struggling with understanding Sass nesting. Any explanations on where I went wrong would be greatly appreciated, as this is a beginner-level issue for me. Thank you in advance. .header { display: flex; height: 10vh; background-color: #13192 ...

Is it possible to adjust the height of sibling divs within a sequence to match the tallest div?

Do you have a set of inline div containers with hardcoded widths but varying content heights? Is there a way to ensure that all divs maintain the same height without risking content overflowing from its parent container? I've experimented with inher ...

How to center align a button in the footer of a Bootstrap card

I'm currently using Bootstrap 5.1.3 and facing a challenge in centering a button within the footer of a card. Below is the code snippet I am working with: CSS .btnStandard { min-width: 10vw; } HTML <div class="card-footer justify-content- ...

The specified locator for the robot framework element could not be located

During my application testing in robot framework using RIDE editor, I encountered the following error. The element with the locator 'xpath: //*[contains(text(), "Applicant")]' was not found. Interestingly, the HTML page does contain the Appli ...

What is the best way to position an image in the center of an Ionic 2 application?

Hey there, I've got a few pages in my Ionic 2 app that contain an <ion-img> inside an <ion-content padding> like this: <ion-content padding> <p>Some text here....</p> <p>Some other text here...</p> < ...

Support for these CSS properties of left: 0; and right: 0; are compatible with

Just wondering if it's okay to utilize the CSS code below to ensure the element adjusts to its parent's width. .element { position: absolute; left: 0; right: 0; background-color: #ccc; border-top: 1px solid #ddd; } We don&ap ...

Modify the date input format in PHP, Bootstrap, Javascript, and HTML5

My current date input format is mm/dd/yyyy and I would like to change it to dd/mm/yyyy. Does anyone know how to do this? I am using Bootstrap 4. Here is the code snippet: <!DOCTYPE html> <html> <head> <title></title> ...

Enhance Your Text Areas with Vue.js Filtering

Currently, I am working with a textarea that has v-model: <textarea v-model="text"></textarea> I am wondering how to filter this textarea in Vue. My goal is to prevent the inclusion of these HTML quotes: &amp;amp;#039;id&amp;amp;#039 ...

Changing the Size of an Image using HTML and CSS

Does anyone know how to resize images using CSS in an external style sheet instead of directly in the HTML document? I've tried searching on W3Schools but haven't been able to find a solution. I want to maintain consistent styling by resizing im ...

Ensuring the height of the body and content div in Bootstrap 4 combined with Angular set to

Is there a way to center the <div class="card"> in the middle of the page or body? It works perfectly on a desktop browser, but on mobile view, it's not aligning properly. How can I center it using... html, body { height: 100%; background: ...

Issue with the carousel feature displaying multiple images in Bootstrap 4.3

I attempted to create a Carousel using bootstrap that displays multiple images in a row and slides one image at a time, similar to this: https://i.sstatic.net/tw22R.png I followed this post. Instead of using bootstrap-3.3.6 and jquery-2.2.2, I used boots ...

Obtain the incremented input's value

Seeking advice: I have a dilemma with two buttons that increase or decrease an input value. How can I retrieve the value upon submission of the result? Previous attempts have yielded 'undefined' or '0' values. Your insights and guidanc ...

Having trouble centering text vertically in game grid using flexbox styling

I'm working on creating a tic-tac-toe game, but I'm struggling to get the x and o marks to align properly both vertically and horizontally. Take a look at my code below. The "marked" values are the ones containing letters: ul { display: fl ...

Tips for hiding the frame of a React MUI Select component

I am having trouble figuring out how to remove the border around the <Select> component from the React Material UI library. In the image below, you can see that when the <Select> component is not selected, it has a black border/frame. https:// ...

SVG fill with no color

Currently, I am attempting to utilize a wave SVG while also having a background image set for the body of the webpage. However, I am encountering an issue where I want the SVG to be filled with transparency so that the body background image shows through. ...