Questions regarding the navigation bar

I am currently working on designing a navigation bar featuring a dropdown menu.

I envision HOME, FIXTURES, RESULTS, LEADERBOARD all appearing on the same line. Specifically, I would like UPCOMING WEEK, MONTHS to be the dropdown children of FIXTURES, and GOALS, ASSISTS as the children of LEADERBOARD. Despite setting the display: inline property for the first level li tags, RESULTS and LEADERBOARD are displaying on separate lines. What could be causing this issue and what steps can I take to correct it?

<!DOCTYPE html>
<html>
<head>
<style>
  .wrap{
  text-align: center;
  background-color: black;
  margin: 0px;
  padding: 10px;
  }

  .wrap>ul>li{
  list-style: none;
  display: inline;
  padding: 40px;
  }
  .drop li{
    list-style: none;
    
  }

  .wrap ul li a{
    text-decoration: none;
    font-size: 20px;
    color:white;
  }


</style>
</head>
<body>
  <div class="wrap">
  <ul>
    <li><a href="#">Home</a></li>
    <li><a href="#">Fixtures</a></li>
        <ul class="drop">
          <li><a href="#">Upcoming Week</a></li>
          <li><a href="#">Month</a></li>
        </ul>
    <li><a href="#">Results</a></li>
    <li><a href="#">Leaderboard</a></li>
        <ul class="drop">
          <li><a href="#">Goals</a></li>
          <li><a href="#">Assists</a></li>
        </ul>
  </ul>
  </div>
</body>
</html>

Answer №1

Does this provide the desired outcome?

.wrap {
  text-align: center;
  background-color: black;
  margin: 0px;
  padding: 10px;
}

ul {
  padding: 0;
  margin: 0;
}

.wrap>ul {
  display: flex;
  justify-content: space-between;
}

.wrap>ul>li {
  list-style: none;
  display: inline;
}

.drop li {
  list-style: none;
}

.wrap ul li a {
  text-decoration: none;
  font-size: 20px;
  color: white;
}
<div class="wrap">
  <ul>
    <li><a href="#">Home</a></li>
    <li>
      <a href="#">Fixtures</a>
      <ul class="drop">
        <li><a href="#">Upcoming Week</a></li>
        <li><a href="#">Month</a></li>
      </ul>
    </li>
    <li><a href="#">Results</a></li>
    <li>
      <a href="#">Leaderboard</a>
      <ul class="drop">
        <li><a href="#">Goals</a></li>
        <li><a href="#">Assists</a></li>
      </ul>
    </li>
  </ul>
</div>

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

Issue with CSS: Hover effect causing unexpected additional white space

My main goal is to implement a hover effect that covers an entire section, but I'm facing some challenges. When I hover over my products, it doesn't behave as expected and adds extra white space below while not covering the section properly. Thi ...

Is there a way to eliminate the white background or border on my Font Awesome checkbox?

One issue I'm encountering with Font Awesome 5 is that, when I click on my checkbox, there is an unwanted white background or border that I can't seem to get rid of. /* Updating default snippet color for better visibility of the issue */ body ...

The alignment issue persists when attempting to set 'relative' on the parent and 'absolute' on the inner element in a Bootstrap column for bottom alignment

Here is a snippet of my basic HTML code: <div class = "row"> <div class = "col-xs-8"> <p>long long long long text that generates a taller column</p> </div> <div class = "col-xs-4"> <p> ...

displaying a separate HTML file with its own distinct CSS styling

Recently, I was tasked with investigating an existing website. Currently, the website utilizes a single root html file that contains multiple iframes linking to external html pages. However, the team behind the website has noticed that this setup is causin ...

Utilizing jQuery to highlight and customize portfolio items with odd numbers

I'm currently trying to rearrange the module header and portfolio image for odd-numbered portfolio items. Feel free to check out my sandbox here. I thought the code below might do the trick, but it's a no-go. jQuery(document).ready(function($){ ...

Safari displays text in a noticeably bigger font size compared to other browsers

I'm currently working on a website and have noticed that the fonts appear larger on Mac's Safari compared to other browsers. We are using the 'Open Sans' font from Google Fonts for our website. For example, here is a CSS snippet for ti ...

The HTML.LabelFor function is failing to display correctly

I am facing an issue with Html.LabelFor where it doesn't render properly. Instead of displaying the value of ProviderName like "AT&T," it just shows the text ProviderName instead of the actual value. <div id="ServiceProvider" class="main_filter" n ...

Achieving distinct CSS margins for mobile and desktop devices in a Django template without the need for multiple {% block content %} statements

Is there a way to dynamically change the margin-left of my main {% block content %} in the base.html template based on whether the viewer is using a mobile or desktop device? This is how my current base.html looks like: <div class="content container-f ...

Using Vue to iterate through a list with conditional logic is as intuitive

I am completely new to vue, and facing a challenge with a conditional situation that I usually handle with PHP. My goal is to iterate through an element with a condition inside it. Below is how I envision the structure: <ul> <li>A</li&g ...

Vanish Dropdown upon clicking Using JavaScript

Hey, I'm new to web development and I'm currently working on creating a web app for iPhone. Everything is going smoothly except for one issue - my dropdown menu works perfectly on desktop Chrome, but on the iPhone's Safari browser, I can&ap ...

Press the button to automatically scroll to a designated div section

One of the challenges I'm facing involves a fixed menu and content box (div) on a webpage. Whenever I click on the menu, the content box should scroll to a specific div. Initially, everything was working fine. Here is a sample of it in action: http ...

Creating customizable divider lines with text next to them using HTML in emails

How can I create an adjustable line with a word next to it, ensuring that long words do not wrap onto a second line? I want the line to stay on one line and the left side to shrink accordingly. Also, I need the text input area to be flexible so I can input ...

Error 410: The Webpage has Disappeared

Unfortunately, my website fell victim to a hacking attack that resulted in the addition of numerous unwanted pages. These pages were quickly indexed by Google, causing a significant drop in traffic. The names of these pages all follow a similar pattern, s ...

Utilize JSON data fetched from a URL to dynamically populate an HTML content

There is a JSON file located at a URL that looks like this: [{"tier":"SILVER","leagueName":"Tryndamere's Wizards","queueType":"RANKED_SOLO_5x5","playerOrTeamId":"91248124", "playerOrTeamName":"NunoC99","leaguePoints":18,"wins":411,"losses":430,"rank" ...

Using ng-repeat in Angular causes the style of a div to become hidden

Utilizing angular ng-repeat to generate multiple divs, the original template html code is as follows: <div class="span5 noMarginLeft"> <div class="dark"> <h1>Timeline</h1> <div class="timeline"> <div c ...

Is there a way to switch between showing and hiding all images rather than just hiding them one by one?

Is there a way I can modify my code to create a button that toggles between hiding and showing all images (under the user_upload class), instead of just hiding them? function hidei(id) { $('.user_upload').toggle(); Any suggestions would be grea ...

Move the element from the center of the screen back to its starting position

Looking to craft a single animation that will transition elements from the center of the current view back to their original positions. Unfortunately, CSS animations do not support toggling the display property. This limitation causes the second rectangle ...

"Styling a play button on top of an image using CSS

Can someone please assist me in properly displaying a play button over a thumbnail using CSS in my WordPress site? I have tried various methods without success. Any guidance on where I may be going wrong would be greatly appreciated. .post-thumbnail-sid ...

I am in search of a clean and efficient method to modify the class of a link that triggers an HTMX request in Django. Perhaps something like "auto-refresh" or a similar solution would be ideal

I've encountered an issue with HTMX in Django. The page consists of two main components: a list of categories and the content that is displayed when a category is clicked. Initially, everything was working smoothly with standard htmx functionality. H ...

Add a 'tag a' directly following 'img'

Check out this code snippet: <a href="#" class="list-group-item"> <span class="badge"><?=$st ?></span> <img class="small_profile_pic" src="<?=$pic ?>" /> aaa<a ...