My content is unselectable due to grid overlap and z-index conflict

I'm currently working on coding a portfolio and need some assistance with creating a nav bar within my grid layout. The main challenge I'm facing is trying to have two main sections - a nav bar and the main content, where the content scrolls vertically edge-to-edge while the nav bar remains static.

The issue arises when the two sections overlap in the first row. If I adjust the z-index so that the content scrolls properly, the navbar becomes unselectable, and vice versa.

Am I approach this correctly?

In essence, I want my content to scroll smoothly in the center of the page while the nav bar stays fixed. However, their current overlapping design makes it difficult to access either one seamlessly.

When I attempted moving the content to a second row, the nav bar cut off the top portion of my content, causing an alignment issue.

I experimented with setting the nav bar as absolute positioning, but I'm hesitant as it may not adhere to conventional practices.

.wrapper {
  display: grid;
  grid-template-columns: 1fr 2fr .5fr 1fr;
  grid-template-rows: 1fr;
  grid-area: 100%;
}

.topnav {
  display: flex;
  align-items: baseline;
  min-height: 8vh;
  margin-left: 10%;
  margin-right: 10%;
  grid-column: 1 / span 4;
  grid-row: 1;
  z-index: 1;
}

#scrollcontent {
  overflow: scroll;
  height: 100vh;
  grid-column: 1 / span 4;
  grid-row: 1;
  z-index: 1;
}

.column {
  display: flex;
  flex-direction: column;
  flex-basis: 100%;
  flex: 1;
  align-items: center;
  align-content: center;
}
<div class="wrapper">
  <div class="topnav">
    <div class="logo">
      <a href="About.html">
Me
</a>
    </div>
    <div class="navlinks">
      <a href="#work" id="work">WORK</a>
      <a href="About.html" id="about">ABOUT</a>
    </div>
    <div id="scrollcontent">
      <div class='column'>
        <div class='projimg1'>
          <img src="img/Hero%20image%20for%20projects(larger).png" alt="Project" class="responsive">
          <div class="proj1text">
            <h3>Heading</h3>
            <h3>Lorem Ispem abcdefg hijklmnop</h3>
          </div>
          /* list of projects */
        </div>
      </div>
    </div>

Answer №1

By utilizing the z-index property to stack .navlinks on top and #scrollcontent below, you can allow the top row of #scrollcontent to scroll underneath the .navlinks bar. However, adding a padding-top or margin-top to the #scrollcontent, matching the height of .navlinks, will prevent the first row from going under the .navlinks due to the presence of the top padding/margin.

To ensure that the content extends all the way to the browser edges, consider using

html, body { padding: 0; margin: 0; }
. It seems like Bootstrap incorporates this automatically.

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

What is the method to modify a user's data when the edit button is clicked?

Looking for help with editing the Edit button functionality in the register.php file using PHP. The requirement is to display a form that shows fields containing existing user data, allowing admin users to update the information. I've spent three days ...

showcasing pictures on a .handlebars/html interface

Having some trouble linking images to my .handlebars/html files in the views directory. I've already set up a public folder as per the requirements, but the linked images still aren't showing up when I view my webpage. Below is the node.js code ...

What are some ways I can ensure my DIV is transparent?

I am struggling with the code below: <div class="clearfix"> <div style="float: left; padding-right: 1%;"> <label class="adm">Created</label> </div> <div style="float: left; padding-right: 1%;"> <lab ...

What is the reason behind my Canvas loading only after I save the new code?

I'm currently facing an issue with loading an image into my canvas. The strange thing is, when I load the page, the image doesn't appear, even though the image src is logging correctly in the console. However, if I save my code and trigger a refr ...

How come the display is not aligned correctly when using display: inline-block along with text?

Could someone explain why a div with display: inline-block aligns differently when there is text or another element inside it? I know that vertical-align can fix this issue, but I'm curious to understand how the browser makes its decision on how to di ...

Guide on Deleting Specific Item Using SQL Data Source Delete Statement

I am facing an issue when trying to remove a specific item from a grid view in my SQL server database. I have configured DataKeyNames and linked a sql data source with the grid view. The delete command is set as follows: DeleteCommand="DELETE FROM product ...

testing to see if the value is equal to "null"

I'm having trouble determining if a value is "null." Here is the code snippet I'm working with: Milestone: any={}; constructor(public toastController: ToastController) { this.Milestone.MilestoneType=''; this.Milestone.date=&apo ...

The hierarchy of the <div> element within the <ul> element gets altered in Internet Explorer due to the ASP.NET Repeater control

Using a Repeater control, I am displaying a list of elements with the following code snippet: <td id="tdLeftBlock"> <ul id="leftList"> <asp:Repeater ID="rptLatestListingsLeft" runat="server" ...

Extracting information from CSS code

I am struggling to parse a RSS feed because all the information is contained within the description element. The CSS formatting makes it challenging to extract the actual strings. For example, below is a snippet of the description element: <table style ...

What is the best way to select the second HTML element identical to the first element using Selenium and Python?

Is there a way to click on a specific instance of a button that appears multiple times on a website? For example, how can I click on the second button and not the first one? Below is the code for the button I am trying to target: <a href="/us/en/outlet ...

Focusing on the final (but not ultimate) elements within a specified tag

I am facing a challenge with an HTML structure containing multiple instances of a certain element along with two p elements beneath each: <some_tag></some_tag> <p></p> <p></p> <some_tag></some_tag> <p> ...

What are the key benefits of opting for flexbox over solely relying on display: inline?

While it may be more convenient to use flexbox over older concepts like display: inline; float: right When comparing simply adding a container and using display: flex; versus changing each element inside the container to display: inline;, what are the be ...

How can I assign a true or false value to an input variable in HTML using AngularTS?

I copied the following HTML code: <tag-input fullWidth id="inputDir" formControlName="inputDir" [modelAsStrings]="true" [placeholder]="'choice feature'" ...

What's the correct way to utilize "for loops" in Jquery without making errors?

Having an issue: I am working with a basic unordered list of truncated posts. Each post should expand when clicked using the .replaceWith method. However, I am facing a problem where clicking on any post returns the content of all posts in the list instead ...

How to update data in FullCalendar using Bootstrap modal

While using a FullCalendar within a modal, I encountered an issue where the information for a user would not refresh when opening another modal. Despite trying various solutions from Stackoverflow, none seemed to work. The only time it did function properl ...

Ensure that text remains centered within a resizable div without wrapping

My website features a sidebar menu that is resizable and has a collapse animation transition. Some of the text in this sidebar needs to be centered, but I've run into an issue - when using text-align: center; to format the text, it shifts around as yo ...

Tips on enlarging a webpage without showing the scroll bar on the main component

My goal is to create a webpage that resembles a window application. However, I've encountered an issue where zooming in on the page results in a scroll bar appearing on the main page. The parameters for the main page (the parent) are set as follows: w ...

What is the best way to utilize a template within a select dropdown?

Utilizing Knockout.js, I've successfully created a pseudo-select list with the following code: <div style="width:325px;height:500px;overflow:auto;" data-bind="template: { name: 'group-tmpl', foreach: explorer().categoryData }"></di ...

Utilize JavaScript code with AJAX content without repeated inclusion

My index.php file allows users to input day, month, year, and more. Using ajax, I dynamically display the results. $(document).ready(function() { $('#searchBtn').click(function() { $.ajax({ url: &a ...

What is the reason behind the success of this location?

Curious about the functionality of this particular JavaScript code with its corresponding HTML structure: function getCityChoice() { const location = document.querySelector("form").location.value; console.log(location) } <form name="reserve" a ...