Ways to eliminate underline on list items with CSS

Currently, I am delving into frontend development with the NextJs framework. As a newcomer to this field, I am facing a challenge in creating a navbar that displays an underline below each menu item. Despite my attempts at using various CSS properties, none of them seem to be effective.

Here is the code snippet related to my navbar:

Navbar.js

import Link from 'next/link';

const Navbar =  () => {

return(
    <nav className='navigation'>
        <div className="logo">
            <h1>My logo</h1>
        </div> 
        <div className="menu">
            <ul>
                <li className="menu-items"><Link href="/">Home</Link></li>
                <li className="menu-items"><Link href="/about">About</Link></li>
                <li className="menu-items"><Link href="/contact">Contact</Link></li>
            </ul>
        </div>     
    </nav>
  );
}

export default Navbar;

global.css

 html,
 body {
  padding: 0;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
   Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
 }

 .navigation {
 display: flex;
 justify-content: space-between;
}

 .menu-items {
 list-style-type: none;
 display: inline;
 margin-right: 20px;
 background-color: coral;
 color: white;
 padding: 10px;
 border-radius: 3px; 
}

I am seeking guidance on how I can achieve the desired results for my navbar. Any suggestions or advice would be greatly appreciated!

Answer №1

Consider incorporating "Text Decoration".

.menu-items {
 list-style-type: none;
 display: inline;
 margin-right: 20px;
 background-color: coral;
 color: white;
 padding: 10px;
 border-radius: 3px;
 text-decoration: none; /* <=== Insert this line */
}

If that doesn't solve the issue, you can try the following.

.menu-items > a {
  text-decoration: none;
}

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

Having Trouble Loading PHP File with Jquery

I've been struggling with using JQuery/Ajax to load the content of my PHP file into a div tag. Below is the code snippet from my page that attempts to load the file: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/ ...

A step-by-step guide on changing an image

Is it possible to change an image when the user clicks on a link to expand its content? <ul class="accor"> <li> Item 1 <img src="../plus.png"> <p> Lorem ipsum dolor sit amet</p> </li> </ul> $(' ...

Exploring Next.js 13: Organizing folders for dynamic sidebar rendering and associated content sections

I'm struggling to figure out the optimal folder structure for a search flow in Next.js 13 under app/. The desired functionality is as follows: The user lands on /search, enters a search query, and the URL changes to /search?q=my+query A split view di ...

Is there any extra step required in React and Express after installing an SSL certificate in cPanel?

Whenever I visit the site with the htaccess code below: RewriteEngine On RewriteCond %{HTTP_HOST} mypage\.com [NC] RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://mypage.com/$1 [R,L] The page always redirects to /index.html, which is empty. ...

Creating an Ajax script to show a comment or information box when a webpage fails to load

Below is the code snippet: <script> function AjaxLoadFWs() { var sPath = window.location.pathname; var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); $('#overviewfw').load("http://test.com/test. ...

A guide on assigning a React type to a React variable within a namespace in a d.ts file

How can I properly declare a namespace named PluginApi for users to utilize this d.ts file for code recommendations? In the code snippet below, React is referencing its own const React instead of the React library. What steps should I take to resolve thi ...

Incorporate server-side tags into client-side HTML and JavaScript scripts without the use of template engines

My goal is to carry out the following operation within client-side JavaScript from a file served using Node and Express: var rootURL = <%= "someurlfromserverconfig" %>; I am solely hosting a web directory from my Node app without any template engin ...

What is the process of converting an Array that is nested within an Object?

I am facing compile errors while attempting to convert an Object containing an Array of Objects. Here is the initial structure: export interface CourseRaw { metaInfo: MetaInfoRaw; gameCode: number; gameText: string; images?: ImageRaw[]; // Having ...

Tips for resizing a larger image to display only a specific portion in CSS (and incorporating JS if needed)

I need to resize an image that measures 1024x1024 and is segmented into 4 quadrants: My goal is to reduce the size of this image so that quadrant 2 is 256x256 while masking out or hiding the remaining 3 quadrants, displaying only the desired section on th ...

JavaScript array contains duplicate values

I have developed a custom Asp.Net user control. To keep things simple, I have omitted some of the HTML code. <asp:Panel ID="PanelInputControl" runat="server" CssClass="input-control input-period"> <div ID="InputWrapperMonth" runat="server" c ...

Error Arises When React Components Are Nested within Objects

I'm encountering a peculiar issue with my component. It works perfectly fine when retrieving data from State at a high level, but as soon as I try to access nested objects, it throws an error: "TypeError: Cannot read property 'name' of undef ...

How can I transform a JSON object into a serialized string for processing on the server side?

Trying to convert a returned JSON object into a serialized string for further processing with PHP server-side code: The object returned appears as follows: Object {id: "123456787654321", email: "<a href="/cdn-cgi/l/email-protection" class="__cf_email_ ...

The classification of a property is determined by the types of the other properties present

I am trying to figure out a way in Typescript to create a general component that takes a prop called component, with the remaining props being specific to that component. How can I achieve this? For example: <FormField component={Input} ... /> Thi ...

Distinctive design for three different list items

Currently working on a project that involves the use of ul and li elements. I need to change the background for every 3rd li element in alternating patterns. Since the li elements are generated from the backend, I do not know how many there will be. I at ...

Convert a binary array into a signed 64-bit integer

Although JavaScript may not accurately represent all 64-bit integer numbers, it can handle numbers larger than 32 bits, which is what I am looking for. I need JavaScript to provide me with whatever level of precision it can offer. I have a byte array of a ...

How can I implement a feature in React where a button remains disabled until all text areas are filled?

I am working with React and I have a requirement to disable a button until all text areas are filled out. Once all text areas are filled, the button should be enabled. How can I achieve this? Would it be possible to add validation for each input field as w ...

Filter out the truthy values in an array with JavaScript

I am currently working with a javascript array called 'foo' which looks like this: var foo = [false,false,true,false,true]; My goal is to eliminate all the 'true' values and only keep the 'false' ones, resulting in this arra ...

When the height is set to 100vh, the Div and Image appear misaligned vertically

Could someone explain why there is a vertical separation between the div and the image? <div style="height: 100vh; display: inline-block;width: 50%; background-color: blue">TEST </div><!-- --><img src="photos/openening.jpg" alt="SICK ...

Choose a JavaScript function by clicking on the HTML text

As a beginner in the world of coding, I have been diving into JavaScript, HTML, and CSS. Inspired by fictional supercomputers like the Batcomputer and Jarvis, I've challenged myself to create my own personal assistant to manage tasks, games, programs, ...

Combining user input data using JavaScript and Vue.js

I am working on a form using Vue.js and I want to combine the data from the input fields upon submission. I have been struggling to achieve this and created a jsfiddle to showcase my attempt. In my form, I have three Vue components for each of the input f ...