Struggling to make the right-side margin function correctly on a fixed navbar using a grid layout

Currently, I have successfully implemented a sticky top navbar. The issue arises when I try to add a 15vw margin to the right side of the logo image, similar to what I have done on the left side. Despite my attempts, it doesn't seem to work and I'm unsure why. As a newcomer to this field, I believe there must be a straightforward solution that I am overlooking!

Here is the HTML code:

  <!-- Navigation Bar -->
   <nav class="navbar">
     <a class="nav-logo" href="index.html"><img src="https://i.imgur.com/1LnAM3W.png" title="Home" height="50px"></a>
     <b class="filler"></b>
     <a id="about-us" class="nav-link" href="about_us.html">About Us</a>
     <a id="our-mentors" class="nav-link active" href="our_mentors.html">Our Mentors<a/>
     <a id="bookings" class="nav-link" href="bookings.html">Bookings</a>
     <a id="contact" class="nav-link" href="contact_us.html">Contact</a>
   </nav>

Additionally, here is the corresponding CSS code:

/* Styling for the navigation bar */
.navbar {
  display: grid;
  grid-template-rows: 55px;
  grid-template-columns: max-content 1fr max-content max-content max-content max-content;
  grid-template-areas: "nav-logo filler about-us our-mentors bookings contact-us";
  overflow: hidden;
  background-color: white;
  position: fixed;
  top: 0;
  width: 100%;
}

.nav-logo {
  grid-area: "nav-logo";
  position: fixed;
  margin-left: 15vw;
}

.filler        { grid-area: filler;
                 background: white }
#about-us      { grid-area: about-us }
#our-mentors   { grid-area: our-mentors }
#bookings      { grid-area: bookings }
#contact-us    { grid-area: contact-us;
                 margin-right: 15vw }

I continue to face issues with applying the margin to the "contact-us" grid item located on the far right. Unfortunately, even after following a non-bootstrap approach, the problem persists. Any insights or suggestions would be greatly appreciated.

Answer №1

Your contact link's id does not match the one in your CSS. Consider using id="contact-us" in your HTML or #contact in your CSS for it to function properly!

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

Is it possible to maintain child divs in a single line?

Despite trying numerous recommendations (many involving white-space:nowrap and display:inline-block), I have been unsuccessful in keeping these child divs on a single line with horizontal scrolling. This is my code: <div id="list"> < ...

Using Bootstrap's dual listbox, you can easily select single options with the ability to add or delete them. Upon selection, the

Could someone please assist me in resolving this issue? I am looking for a dual listbox with single select option, unlike Bootstrap which only offers dual listboxes with single/multiple select. To Clarify: Here is an example: In my dual listbox, the le ...

I'm having trouble getting a response from the user.php file in my login system

I am trying to create a login system using ajax and pdo with a button as the submitter. The issue I am facing is that when I click the button to execute, nothing happens. There are no errors in the console. I can see in the network tab that it sends the us ...

Unable to resize static and draggable elements simultaneously

Observe this fiddle to see the demonstration: DEMO If you are interested in the resizing of white divs, check out this link: Resizing of White divs The draggable divs are represented by red while the static divs are shown in white and located in droppabl ...

What could be the reason for the checkbox being toggled twice?

Here is the code snippet I am working with: $("input[type='checkbox']").each(function() { var current = $(this); $("label[for='" + current.attr("id") + "']").on('click', function() { current.change(); al ...

Information is not appearing in the dropdown menu

As a beginner in JavaScript, this is my first program. I have written HTML and JavaScript code to display data in a dropdown menu from a Python Django database. However, when I run it, the data is not showing up. Here is my code: <!DOCTYPE html> < ...

Uncovering the specific file housing a CSS definition

I'm currently navigating a complex webpage with numerous CSS files that were not authored by me. I am struggling to identify a CSS style that seems elusive, as it is not located in the most obvious places (such as the CSS files) and I have no idea whe ...

Visit a webpage on my site

Is it feasible to embed a website within another website? Suppose I have my index.html file. What if in the center of that file, we include an iFrame or similar element that loads , allowing users to explore Google directly on my website? ...

Why does this inner HTML table always adjust its width based on the content within it? Is there a way to make it match the width of its container instead

I'm not very familiar with HTML and CSS, and I've come across a problem. Here is the CSS structure in question: <!-- TECHNICAL REFERENCE: --> <div id="referenteTecnicoTab"> <table width="800px" class="standard-table-cls table-he ...

Replicating a tag and inputting the field content

Scenario: An issue arises with copying a label text and input field as one unit, instead of just the text. Solution Needed: Develop a method to copy both the text and the input field simultaneously by selecting the entire line. Challenge Encountered: Pre ...

As I scroll, I wish for the search bar to remain fixed at the top of the

Help needed! I'm currently working on a website for a client, and they want the search bar to stay fixed as users scroll down. I've been struggling with this task and can't seem to get it right. Any assistance would be greatly appreciated. T ...

Implement the color codes specified in the AngularJS file into the SASS file

Once the user logs in, I retrieve a color code that is stored in localstorage and use it throughout the application. However, the challenge lies in replacing this color code in the SASS file. $Primary-color:#491e6a; $Secondary-color:#e5673a; $button-color ...

What is the method for implementing a dropdown box with select and non-select checkboxes, similar to the example shown in the image, using AngularJS?

https://i.sstatic.net/CTx8K.jpg I am seeking assistance in incorporating the image below into a dropdown menu using angularjs ...

Modify the CSS selector for a dropdown menu element upon selection

I have customized a select box using CSS, but I am facing an issue where the custom arrow remains upward even after selecting an option. I want the arrow to point downwards once an option is chosen and revert to the default position when clicked outside. ...

Preventing duplicate Google indexing with .htaccess

I have a website that utilizes a RewriteRule in the root directory to direct queries in this format: http://domain.com/foo/parameter to http://domain.com/index.php?args=parameter Visitors only see the clean URL and everything works smoothly. However, ...

CSS Tutorial: Creating a Dynamic Gradient Bar

I am looking to create a dynamic colored bar with a moving color gradient effect. Without using JavaScript, I want to achieve this effect using CSS 3 properties such as gradients and animations. This is a snippet of what I have tried so far: HTML: <b ...

Experiencing difficulties with incorporating cURL data into MySQL using Simple Dom Parser

Hey there! I'm currently trying to figure out the best way to save my scraped data to a MySQL database. It seems like nothing is getting inserted into the database, and I suspect it might be due to the format of the data I'm passing. Should I con ...

The Dropdown Button Functions Once and Then Stops

I am facing a challenge in implementing a button within an HTML table that triggers a dropdown menu when clicked, and closes upon another click or when the user clicks outside the menu. Oddly, the button only seems to work once before completely losing fun ...

The presence of text is leading to CSS placement troubles

I operate a website dedicated to comic content and am looking to incorporate text (retrieved from the database field "description") beneath each comic thumbnail. Here are my two inquiries: 1) I'm facing an issue where adding text below a comic caus ...

Adjust the alignment of two headers with varying sizes

Can someone provide guidance on aligning two headers of different sizes (e.g. h3 and h5) based on their bottom edges, making them appear like a cohesive group in a sentence format? The current code snippet I am working with is as follows: ...