Safari is displaying an underline on navigation links in CSS

There seems to be an issue with the <a> tags in my nav bar - they are showing a link-underline only on Safari. I've tried using text-decoration: none; but it's not working as expected. This is quite unusual, and I need to find a way to remove it.

https://i.sstatic.net/RXN3r.png

The purple line you see is actually the border-bottom, but what I really need to get rid of is the immediate black underline.

Below is the current code snippet that is causing this behavior -

header {
  height: 50px;
  background-color: #fff;
}

nav {
overflow: hidden;
  text-align: center;
  padding: 10px;
  background-color: #fff;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 999;
}

nav a {
  color: #000000;
  transition: all 0.2s ease-in-out 0s;
  text-decoration: none;
  display: inline-block;
  padding: 15px 15px 5px 15px;
  border-bottom: 2px solid transparent;
}

nav a:link {
  color: #000000;
  text-decoration-line: none;
}

nav a:nth-of-type(1):hover {
  border-color: rgb(255, 29, 142);
}

nav a:nth-of-type(2):hover {
  border-color: rgb(133, 52, 146);
}

nav a:nth-of-type(3):hover {
  border-color: rgb(255, 128, 55);
}

nav a:nth-of-type(4):hover {
  border-color: rgb(0, 182, 223);
}

nav a:nth-of-type(5):hover {
  border-color: rgb(63, 190, 150);
}

nav a:nth-of-type(6):hover {
  border-color: rgb(255, 222, 32);
}

nav a:hover {
  color: #000000;
}
<header>
<nav>
    <a href="<?php the_permalink(4); ?>#particle-slider">Home</a>
    <a href="#what">What we do</a>
    <a href="#who">Who we are</a>
    <a href="#partners">Who we work with</a>
    <a href="#contact">Say hello</a>
    <a href="<?php the_permalink(70); ?>">Blog</a>
</nav>
</header>

Answer №1

After some investigation, I finally solved the issue that puzzled me for a while. It might be slightly embarrassing to admit, but it turns out the problem was only visible in Safari.

nav a:hover {
  color: #000000;
  text-decoration: none;
}

Answer №2

It is more beneficial to implement it in this manner:

  header a:hover 
 {
  color: #000000;
  text-decoration: none! important;
  }

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

I can't see the background color in my DIV element. What could be causing this issue?

/**This code is not changing the color of the row1 class**/ html, body { font-family :'montserrat',sans-serif; } h1 { border-left : 2px solid #00f28f; font-size : 48px; font-weight : 400; padding-left : 20px; } .main { margi ...

The style of react-router links remains unvisited

Currently working on a small website using React Router, I've encountered an issue where only the homepage link receives the visited styles. The other links do not display the visited style, even after being visited. Check out the code here Here is ...

Can images be resized with a transparent background?

I am currently facing an issue with a function that creates 4 resized images. The problem is that images with transparent backgrounds are being recreated with a black background. Does anyone know how I can fix this? I would prefer the background to remai ...

The best practices for coding Jquery plugins to adhere to style guidelines

I have been grappling with this issue for quite some time now, and I am seeking feedback from others. I am in the process of creating a personalized library to expedite web app development, and I want to ensure that I adopt the correct approach. My intenti ...

Discover the job specifications pages on Dice.Com by utilizing C programming language

I have taken on a student project involving web scraping job postings from Dice.Com for analysis. My main focus is on extracting the job description, but I am struggling to figure out how to access it. With limited knowledge in HTML and C#, I find it dif ...

Aligned to the left margin within a container located inside a 6-column Bootstrap division

I currently have two 6 column bootstrap divs positioned side by side within a row div. Both divs contain an image, with each image spanning half the width of the viewport. In the left column, above the image (set as a background via CSS), I want to place a ...

PHP script to dynamically update a MySQL row by passing values through the URL

My goal is to update a MySQL row based on the value passed in the URL of a page. However, I'm encountering an error that reads: Notice: Undefined index: id_store in C:\xampp\htdocs\store\php\update.php on line 29 when I attemp ...

Navigate to the specific tab content by clicking on the menu tab for individual WooCommerce products

I have integrated jQuery code into a PHP function to enable scrolling to tab content when a menu tab item is clicked on WooCommerce single products. The product tabs are arranged in a vertical layout. The script is designed to automatically scroll the user ...

The alignment of CSS boxes at the top is off

My challenge is to stack 3 containers horizontally, but they have different heights and the smaller ones end up at the bottom. How can I resolve this issue? This is the code snippet I am currently using for the boxes: .brand{ border: 1px solid black; bor ...

What causes a neighboring div to change width when a multi-line span is present?

Here is my React code: <InfoWrapper> <InfoCircle> <span>i</span> </InfoCircle> <span className="info-label"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. elit. </span> </InfoWrap ...

Attempting to create a dynamic grid layout utilizing CSS to ensure optimal responsiveness

I am working on creating a webpage layout similar to the one in the link below: The maximum width for the layout is set to 1600px. However, I am facing challenges in making it fully responsive. This is because all the boxes are given widths in percentages ...

I wish to have the sidebar shown initially, then be able to collapse it by clicking a button and adding a dropdown feature to the side of the menu items using Bootstrap

I am looking to implement a sidebar menu using Bootstrap. I want the ability to hide the menu, even on larger screens, by clicking a button. When collapsing the menu to the left side, I want the icons to display on the left as well. Clicking on a menu i ...

Transfer the File object to background.js from the content script, or transmit the createObjectURL and maintain its persistence even after refreshing

My main objective is to execute an in-background file upload task using a file obtained from the content script. I have come to realize that passing a File object directly from the content script to the background is not feasible, as chrome.runtime.sendMe ...

The Continued Saga of IE8 Positioning Woes

Managing a social network for the cystic fibrosis community has been a rewarding experience. One particular section allows users to leave comments and engage in discussions. While the implementation using html, css, and jQuery has been seamless on Firefox, ...

Creating a design with three parallel bars in CSS

For my webpage, I wanted to add an extended flag at the top by creating three horizontal stripes: CSS #main1 div{ width: auto; height: 20px; margin: 0px HTML <div id="main1"> <div style="background-color:red;"></div> <div style="ba ...

When using JQuery Validation on a small screen, error messages can cause the button to shift downwards

After successfully creating an email form with jquery validation error style that appears when there's an error, I encountered a problem. When the screen width is reduced or viewed on a small screen, the error message pushes down the button. I&apos ...

Crafting web design with media queries to ensure responsiveness

I have been working on creating a responsive webpage. While the header and footer are resizing properly when the browser is reduced in size, the navigation section is not behaving the same way. Currently, shrinking the page is causing the navigation block ...

Styling the nested list items with text decoration

I have a scenario where I applied text-decoration: underline; to the parent li, which is being inherited by the child li. Despite trying to remove this style from the child elements using text-decoration: none !important;, it doesn't seem to work. The ...

Ensuring the Angular Material bottom sheet (popover) stays attached to the button

Recently, I've been working on an Angular project where I successfully integrated a bottom sheet from Angular Material. However, I encountered an issue when trying to make the opened popup sticky to the bottom and responsive to its position, but unfor ...

Exploring Angular 6's nested routes and corresponding components for child navigation

I'm currently diving into the concept of lazy loading in Angular 6. Here's a visual representation of the structure of my application: ─src ├───app │ ├───components │ │ ├───about │ │ ├─── ...