I'm having trouble viewing my navigation bar, even though everything seems to be correct

I'm facing an issue where the navigation bar is not visible even though everything seems to be correct. I have checked and double-checked but still can't figure out what's wrong. It's becoming quite frustrating and I'm at a loss for what to do next. Can someone please offer me some assistance?

<html>

<head>
    <link href="app.css" rel="stylesheet" />
</head>

<body>
    <header>
        <div id="topbar">

        </div>
        <nav id="main">

        </nav>
    </header>
</body>

</html>
 body{
     margin: 0;
 }
 header{
     background: url('./images/bg.png') bottom center no-repeat;
     background-size: cover;
     height: 750px;
    
    }
     #topbar {
         height: 70px;
     }

      nav#main {
         height: 150px;
         color: white;
         border-radius: 4px;
        }

Answer №1

The issue lies within the nav#main section of your code, where only the color:white property has been applied. This causes the nav element to be displayed in white color. Additionally, the background-color property has not been set, resulting in it being invisible.

To rectify this, add a background-color property as shown in the snippet below:

body {
  margin: 0;
}

header {
  background: url('./images/bg.png') bottom center no-repeat;
  background-size: cover;
  height: 750px;
}

#topbar {
  height: 70px;
  text-align: center;
}

nav#main {
  color: white;
  background-color: red;
  display: block;
  padding: 10px;
  border-radius: 4px;
}

#main a {
  padding: 10px;
  display: inline-block;
  cursor: pointer;
}

#main a:hover {
  background-color: green;
}
<html>

<head>
  <link href="app.css" rel="stylesheet" />
</head>

<body>
  <header>
    <div id="topbar">
      Hello
    </div>
    <nav id="main">
      <a>View</a>
      <a>Help</a>
      <a>Data</a>
    </nav>
  </header>
</body>

</html>

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

Enhance the Search Box with a Vibrant Glow Effect When in Use

I need help adding a glow effect color around a search field when a user clicks on it to type. I want the border to have a shadow and the glow effect to be orange. I have included the CSS below, but I'm unsure of what to change or add. Any assistance ...

Look into HTML and JavaScript problems specific to IOS devices

I have encountered some HTML markup and JavaScript functionality issues on my web-app that seem to only occur on iPad and iPhone. Unfortunately, I do not have access to any iOS devices to debug these problems. How can I replicate and troubleshoot these i ...

Modify the href attribute of an anchor tag that does not have a specified class or

I am currently using an event plugin that automatically links all schedule text to the main event page through anchor tags, like this: <td><a href="http://apavtcongresso.staging.wpengine.com/event/congresso-apavt-2018/">Chegada dos primeiros c ...

Ways to automatically update a page once the form response is received

After scouring various websites, I still haven't found a solution to my issue. What I need help with is how to refresh a page once a successful deletion message is received for a specific row. My admin2.php page displays information about the admin fr ...

Tips for customizing image flipper AJAX code

I am working on a script that swaps the current image with a selected one, but I need to add an attribute so it specifically targets image tags with a certain class SCRIPT---- <script> $(function(){ Test = { UpdatePreview: func ...

Struggling to repair the unresponsive on-click event even after thorough debugging efforts

i am working on a project where i have to create a datatable, but I am facing an issue with the edit event not firing on click. Even after debugging, it is not pointing towards any error. function GetLoginData() { $.ajax({ url: '/LoginMas ...

Using d3.js to dynamically change the color of svg elements based on their data values

I was searching for a way to dynamically color SVG rectangles based on values from a dataset. If I were to create rectangles for each data entry, how could I adjust the rectangle's color according to the data value? Here is what I currently have: // ...

Creating a CSS Grid with Scroll Snap functionality to mimic an iPhone screen in HTML

I have created an iPhone simulator using HTML. It's in German, but I can provide a translation if needed: // JavaScript code for various functionalities related to the iPhone interface /* CSS styling for the iPhone interface */ <meta name="v ...

Guide: Positioning the Icon in the Top Right Corner of the Image

Objective: The goal is to ensure that the expand icon is always at the upper right corner of the image, regardless of its size or the responsive design in place. Challenge: I have attempted to address this issue but have unfortunately been unsuccessfu ...

What is the best way to bridge the gap between the rows?

After combining the top and bottom blocks, I now have a gap in my layout. Is there a way to move this row up without causing any issues? I need assistance with resolving this problem using Bootstrap. <link rel="stylesheet" href="https://maxcdn.boots ...

The circular loader in reactstrap Spinner is not displaying as expected

I am attempting to display a loader using the reactstrap (v^7.1.0) Spinner component, but nothing is appearing on the screen. When I inspect the page in Chrome, it seems that the CSS for Spinner is not present. https://i.sstatic.net/uVsRn.png Does anyone ...

How can I extract data from HTML popup tables and charts using Python?

Currently, I am in the process of gathering data from for a machine learning project related to MMA. Specifically, my goal is to extract the DraftKings opening odds for each fighter by accessing the odds listed under the DraftKings column. By clicking on ...

HTML and CSS for an off-canvas menu

Looking to create an off-canvas menu that smoothly pushes content out of view instead of cropping it. Additionally, I want to implement a feature that allows the menu to close when clicking outside of it. I found the code for the off-canvas menu on W3Scho ...

Are you experiencing empty boxes instead of Glyphicons in Bootstrap 3?

Having some trouble using Glyphicons with Bootstrap 3. I've noticed that a few of them aren't displaying properly. For instance, when trying to use these three glyphicons, the first one doesn't seem to show up correctly (appears as an empty ...

When attempting to click on the dropdown in Bootstrap, there is no content displayed

I am currently practicing Bootstrap and focusing on implementing Dropdowns. However, I am facing an issue where upon clicking the Dropdown button, nothing appears on the screen. Preview when it's not clicked Preview when it's clicked Here is m ...

Adjust the height of each chosen div in Jquery to match its width

I am looking to dynamically set the height of each selected div equal to its width. However, the following code is not achieving the desired outcome: <div class="row"><div class="col-md-4 squ"></div><div class=&qu ...

What is the best method for saving HTML form data into a Node JS variable?

I am facing an issue with setting the values of HTML form inputs onto my Node JS variables. In the JavaScript code below, I am struggling to assign values to the variables "hostname" and "port," which should then be concatenated to create a new variable ca ...

Display a hidden div only when a cookie is set during the initial visit

I'm currently facing an issue while trying to set multiple cookies based on the existence of a div using JavaScript. On the first visit, I want to display the div to the user if it exists, then set a cookie (named redCookie) that expires in 3 days. Up ...

D3 bar chart displaying identical values but with varying data sets

<!DOCTYPE html> <html lang='en'> <head> <meta charset="UTF-8"/> <title>Interactive Bar Chart using D3</title> <script src="https://d3js.org/d3.v4.min.js"></script> </head> <b ...

What are some ways to optimize a range slider for touch screen usage?

I'm currently working on a small project and encountering an issue where the animation duration of an element needs to be changed using a range slider. The functionality works fine on desktop screens but doesn't seem to work on mobile devices. ...