I am puzzled as to why my text and div boxes are displaying in my navbar/hamburger menu instead of at the bottom of the page

Greetings, everyone! This is my debut post here so bear with me if it's not presented in the correct format.

Currently, I am deep into creating a website using HTML, CSS, and just a hint of JavaScript. My primary focus right now is on building the home page for this site. Within this homepage, I have successfully implemented a hamburger menu. When activated, it reveals a list containing "Home," "Contact," "Features," and more. This aspect of the design works perfectly fine.

However, I ran into a roadblock when attempting to add content boxes below the video section. Although my code seemed flawless, upon previewing the site, I noticed that none of the boxes were visible where they should be. Strangely enough, upon opening the hamburger menu, I could see that the boxes and accompanying text were tucked away in there.

I urgently seek advice on how to rectify this issue by keeping the boxes out of the menu and positioning them at the bottom of the page instead. Your help would be greatly appreciated.

For reference, I have attached an image depicting the current layout:

const menuToggle = document.querySelector('.toggle')
const showCase = document.querySelector('.showcase')

menuToggle.addEventListener('click', () => {
  menuToggle.classList.toggle('active')
  showCase.classList.toggle('active')
})
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700;800&display=swap');
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

.showcase {
  position: absolute;
  right: 0;
  width: 100%;
  min-height: 100vh;
  padding: 100px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: black;
  color: white;
  z-index: 2;
  transition: 0.8s;
}

.showcase header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 40px 100px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  text-transform: uppercase;
  cursor: pointer;
}

.toggle {
  position: relative;
  width: 60px;
  height: 60px;
  background: url('menu.png');
  background-repeat: no-repeat;
  background-size: 30px;
  background-position: center;
  cursor: pointer;
}

.toggle.active {
  background: url('menu.png');
  background-repeat: no-repeat;
  background-size: 25px;
  background-position: center;
}

.showcase video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.8;
}

.showcase.active {
  right: 300px;
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;

  // Remaining CSS properties go here...
}

Despite my attempts to troubleshoot by removing the JavaScript segment, adjusting element spacing, and inspecting the CSS attributes, the issue persists. It baffles me as I am unable to pinpoint where things went wrong. Any guidance or insights provided would be immensely valuable.

Answer №1

By including the position: relative property in your .boxes div, you may be able to resolve the issue as it gives the element a position within the normal flow of the document.

It appears that in your CSS, you have not defined any styles for your .boxes container, resulting in its default setting of static, which is causing the problem.

body{
    overflow-y: "scroll"; (this is optional.)
}
...
.boxes{
     position: relative
}
...

I also noticed that you are using inline <script>. It is recommended to place this at the end of your <body> for better performance.

Feel free to view the effect on CodePen. https://codepen.io/anthonyzhang220/pen/PoEOebw

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 are the steps to achieve complete test coverage for my Angular login form? Encountering an issue with reading property 'subscribe' of undefined

Recently, I made adjustments to my login component to align more closely with Angular standards. However, upon testing, I encountered errors of this kind: Cannot read property 'subscribe' of undefined After using console.log for debugging pur ...

drawImage - Maintain scale while resizing

I am currently working on resizing an image using drawImage while maintaining the scale. Here is what I have so far... window.onload = function() { var c = document.getElementById("myCanvas"); var ctx = c.getContext(" ...

Express Module Paths Failing to Function Properly

When I first started building my routes, I had everything in one api.js file. However, I realized there might be a better approach, so I did some research online to see how others handle it. After following a few tutorials, I decided on a new layout with s ...

Unlocking the parent scope in a custom attribute directive

I am new to utilizing angular js. I came across a similar inquiry on How to access parent scope from within a custom directive *with own scope* in AngularJS? However, the solution provided did not work for my basic test. Here is the sandbox. http://jsfi ...

Is my Discord.js bot malfunctioning due to incorrect indentation, despite the absence of errors?

After spending a considerable amount of time developing this bot, I encountered an issue following an update that introduced 'limitedquests'. Previously, the bot worked flawlessly but now, certain functions are not functioning as intended without ...

What is the reason for the exclusion of the viewport meta tag from the standard guidelines?

Emphasizing the significance of incorporating the viewport meta tag, various sources stress its role in controlling layout on mobile browsers. According to information from MDN's article Using the viewport meta tag to control layout on mobile browsers ...

Incorporate text directly into Bootstrap select input on a single line

I am attempting to include an asterisk in a select input field. I can achieve this easily by applying my own CSS, but the challenge is to accomplish this using Bootstrap 3.3.7 or an older version while displaying the asterisk on the same line as shown in t ...

Verifying the angular form without the need for a submit button

I'm currently utilizing angular.js form validation and I'm looking to implement validation without the use of a form submit button. Below is my HTML code: <form name="userForm"> <input type="hidden" ng-model="StandardID" /> < ...

Choosing multiple images by clicking on their alternative text with jQuery

I am currently working on a project that involves clicking on a thumbnail to enlarge the image and display its name (alt) below it. I have made progress, but there seems to be an issue where only one image is displayed no matter which thumbnail I click on. ...

Container displaying zero height due to masonry issue

Currently, I am developing a project that requires a responsive masonry layout. The container has a maximum width set to 960px, but it is supposed to adjust based on the browser's size. Each grid item has a percentage-based width (100%, 66.666666etc%, ...

Validate if the Jquery AJAX response contains any data

I've been attempting to integrate an alert message in my code that triggers if the response is null, but every time I try to do so, something goes wrong. If anyone has any suggestions or assistance with this issue, it would be greatly appreciated. He ...

Utilizing React JS to assign various state values from a dropdown menu selection

In my project, I have implemented a dropdown list populated from an array of values. This dropdown is linked to a handleSelect function. const handleSelect = (e) => { handleShow() setCommunityName(e) } <DropdownButton id="dropdown-basi ...

Is there a way to dynamically pass values to a form in React?

Learning React on my own has been challenging, especially when trying to accomplish what I thought would be a simple task. To put it briefly, I have a menu with several items. I aim to select a menu item and have a form open next to it. The form shoul ...

How can I show the last li item in a ul element that extends beyond its parent container?

Chat App Development In my current project, I am developing a chat application using React. The app consists of a list (ul element) that displays messages through individual items (li elements). However, I have encountered an issue where the ul element st ...

Unable to upload the file using AJAX

Here is my AJAX request where I am attempting to send form data to a PHP page and display messages accordingly. The problem I'm encountering is that when using serialize() method in AJAX, my file data is not being posted. As a result, the send.php scr ...

The Ubiquity CmdUtils.setSelection function does not support replacing HTML code

I'm working on a Ubiquity command to replace selected links or URLs pointing to images with the actual image itself. However, I've found that the CmdUtils.setSelection() function doesn't work when there are html tags in the selection, render ...

What purpose does the class serve in typescript?

This is a unique version of app.component.ts in the Angular Tour of Hero tutorial. import { Component } from '@angular/core'; export class Superhero{ name : string; id : number; } const SUPERHEROES : Superhero[] = [ {name : 'Wonder ...

JSON Array Position Sequence

I have a system that takes input in the form of lines of text stored as an array, for example: array[123,556,"test",0,0]. By using val().split('\n'), I am able to add each new line to the array so that each line index is incremented by 1. He ...

strange occurrences in localToWorld transformation

Hello there! Currently, I'm working on a project where I'm generating a TextMesh using font geometry and placing it within an empty pivot object. My goal is to obtain the world coordinates of each vertex in the TextMesh so that I can manipulate ...

Retrieving the value of the selected item when it is changed

I am currently using v-select/v-autocomplete in my project: <v-autocomplete v-modal="newRole" :items="roles" label="--Change role--" required return-object item-value="id" item-text=&qu ...