Menu bar link is unresponsive despite being active

I'm struggling to add "a:hover" to my home button in the menu bar and can't seem to remove the text-decoration. When I attempted to use media queries, things got confusing for me.

**To post a question on Stack Overflow, it seems that I need to provide more details.**

body {
background-image: url("blue-bokeh.jpeg");
width: 100%;
height: 100%;
}

.wrap {
height: auto;
width: 90%;
margin: auto;
}

header {
background: #333;
color: white;
height: auto;
width:100%;
float: left;
}

header nav {
width: 100%;
height: auto;
}

header nav ul {
list-style: none;
height: auto;
width: auto; /* what happens if i change the value to 100% */
float: right;
margin-right:30px;
}

... (OMITTED FOR BREVITY) ...

@media screen and (max-width: 700px) {
    body {
    background-image: url("blue-bokeh.jpeg");
    width: 100%;
   ... (OMITTED FOR BREVITY) ...
    }
}
  
    
    
   
... (OMITTED FOR BREVITY) ...

Answer №1

Is your goal to achieve a layout similar to this?

https://jsfiddle.net/9r85wnac/2/

I made some enhancements and restructured the elements. Now, the active class is applied to the li element instead of the anchor. When hovering over the anchor within the active li, it will change its color (or any other styling you prefer):

header nav ul li.active a:hover{
  color: blue;
  /* custom styles here */
}

In addition, I removed the text decoration:

header nav ul li.active a {
    text-decoration: none;
    cursor: pointer;
}

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

Footer not being pushed down by content in mobile view on page

Hello everyone, Can you assist me with a query, please? My form works perfectly fine in desktop view, but it gets cut off on mobile view and I'm unsure of the reason why. Here is my code: .upload-pic { position: absolute; max-width: au ...

Click the button to add content to the top section of the div using jQuery

Looking for some assistance with a web development issue I'm facing. Here's the scenario: I have two sections on my webpage - TOP and BOTTOM. In the bottom section, there are 3 list records each with a checkbox and button. What I need help with ...

What method is best for deleting an item from the database in HTML structure - POST, GET, or XHR action?

I have a webpage that displays content in a table format and allows users to delete a specific row by clicking on it. The structure of my rows is as follows: foreach ($rewards as $reward) { echo '<tr id="' . $reward[&apos ...

Creating a floating div that remains in place without disturbing the layout of the surrounding elements on

I am trying to place a div within a page at specific coordinates without affecting the rest of the content on the page. My initial approach was to give the parent container a position: absolute and the floating div a position: relative, then setting the p ...

Tips for personalizing the appearance of a jQuery mobile dialog box?

I've been trying to control the timing of when the jQuery dialog box appears, but nothing I do seems to be effective. Here's what I've attempted so far: <html> <head> <meta charset="UTF-8"> <title>Document&l ...

Use the selector on elements that have been previously chosen

Sorry if this is a silly question, but maybe today's just not my day. Say I already have a selected element, for example: let tables = $('table'); Now, what if I want to add another selector like .some-class to those tables, without creati ...

How do I use PHP to dynamically generate lists in HTML with the <li> tag?

Is there a way to repeat the <li> element in this code snippet? I have been attempting to create a loop for the "<li>" block, but it keeps showing me an error. <?php $html .= " <li> <a href=''> <span& ...

Pseudo-class for clicking a button on Mobile WebKit

Currently, I am in the process of developing a private framework to replicate the iOS UI using CSS 3 and HTML 5. Most of the widgets have been created, including various colored gradient buttons, but faced with challenges when attempting to incorporate a b ...

Ensure that all floating divs have uniform height

How can I ensure that two divs placed side by side will always have the same height, even when one of them changes based on content, using only CSS? I created a fiddle to demonstrate. I want both the red and blue divs to have equal heights... http://jsfi ...

Tips for including data labels in a scatter plot using d3.js

I am currently studying d3.js for data visualization and I have chosen to work with the titanic dataset My objective is to incorporate passenger names into my visualization so that when a cursor hovers over a point, the person's name is displayed. H ...

What is the best way to display lengthy content using a pair of HTML tags?

I am facing an issue with my Angular4 app where I have a <md-card-content> tag on part of my page. Inside this tag, I am trying to display some content within a <p> tag which has a maximum height of 20cm. While this setup works fine for short ...

Exploring ReactJS: Combining JSON data with HTML elements

Recently, I started learning ReactJS. As I'm iterating through JSON data, I realized I need to incorporate some links into it. This is how my JSON data is structured: "text": ["For more information on the functionalities of the platform and services ...

Tips on setting background color for ODD and EVEN rows using PHP?

I am looking to incorporate background colors for alternating rows, with odd rows being #e5e8e8 and even rows being #b9b8bb, using CSS. for ($i = 2; $i <= $arrayCount; $i++) { $_SESSION["a"] = trim($allDataInSheet[$i]["A"]); $_SESSION[ ...

The content in the footer will not be visible, the text paragraph will remain unbroken, and the image will be displayed above the navigation bar

Issue #1: The text in the footer has mysteriously disappeared. I only noticed when adjusting other elements that the footer text was no longer visible. https://i.sstatic.net/clY6i.jpg Problem #2: The paragraph content does not wrap correctly. Without usi ...

Troubleshooting a JavaScript function's ineffectiveness when triggered by clicking an

What is causing the function to not work properly when I click on the "Rate me" button? function increaseValue(){ var rate = parseInt($("#rateme").value, 10); rate = isNaN(rate) ? 0 : rate; rate++; $("#rateme").value = rate; } <scr ...

The Javascript function is triggered only upon the second click

My goal is to retrieve prescription details for a specific patient, with the results displayed in a modal window. However, I am encountering an issue where the first result is only obtained on the second click. Subsequent clicks display the results of the ...

The identical web address functions as a point of reference for design, however it does not function as an AJAX request

This piece of code is functioning properly: {html} {head> {**link rel="stylesheet" href="http://localhost:3000/CSS/mystyle.css"**} {/head} {body} {/body} {/html} However, when I use the same URL in this ...

Library of User Interface components for React Native applications

As I embark on my journey of building my first major app using React Native, a question comes to mind. Is there a UI framework available for React Native that offers pre-styled components right out of the box? Similar to how Ionic provides a base theme a ...

Selecting properties from a GeoJSON object on the fly with Leaflet

I am currently attempting to dynamically modify the displayed property on my leaflet map. Below is the code I have been working with: $("#button_thermal").click(function(){ $.getJSON("physicalProperties.geojson", function(data) { var geojson2 = L.geoJson( ...

In Internet Explorer, when utilizing a table-cell with a variable height, the position should be set to absolute for

I'm struggling with getting a uniform height in my horizontal layout using display: table-cell. While it looks great in Chrome, I can't seem to get Internet Explorer to display it the same way. Check out this link for reference This is how I wa ...