What is the reason for the unique behavior of position absolute in particles.js when used with bootstrap?

I'm trying to understand the logic behind why position absolute behaves the way it does when applied to elements.

From my understanding, an element with position absolute is supposed to be positioned relative to its first parent element that has a position other than static. In this case, that would be the body element.

However, I am puzzled as to why about.js does not overlap with the navigation element (which has a static position), but instead overlaps with particles.js (which was unintentional).

Furthermore, when I place the div with id particles.js on top of the div with class about, the about section ends up overlapping with the portfolio section. Can anyone shed some light on this situation?

Below is a snippet of my CSS code:

* {
  box-sizing: border-box;
}
img[alt="Profile Picture"] {
  width: 40%;
}
/* Not sure why this works */
img {
  width: 200px;
  height: 200px;
}

.about {
  position: absolute; 
  border: 10px pink solid;
  z-index: 1;
  height: 100vh;
  width: 100vw;
}
#particles-js {
  background: rgb(29, 114, 243);
  height: 100vh;
  width: 100vw;
}

Any insights would be greatly appreciated!

Answer №1

To ensure the about section does not overlap with the particles section, it is recommended to eliminate the position: absolute declaration from the .about class. This particular rule removes .about's position from the normal flow of block elements, causing it to overlap.

In addition, it appears that the navigation element is not actually being covered by the .about section. The transparency of the navigation elements' color is creating this illusion. To rectify this issue, try incorporating a background-color: white rule for the navigation element.

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

Setting up the initial 3 parameters in a v-for loop

What is the best way to begin a v-for loop? For instance, we have an array named "array" with the following values: array = [dog, cat, e, f, g]; I am interested in using a v-for loop that will start looping through and only consider the first 3 values. ...

Exploring the search feature within dropdown menus with Bootstrap 4

After clicking on the dropdown menu, there are no choices to select from. $(function() { $('.selectpicker').selectpicker(); }); <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integri ...

Can a specific CSS rule be written in Material UI using makeStyles that will only apply if the element has both classes together?

It's common knowledge that achieving this in CSS is a possibility. .makeStyles-mainNavWrapper-67.sticky{ position: fixed; top: 0px; opacity: 1; transition: opacity 1s ease; padding: 10px; } I am curious to find out if this can be achieved ...

Tips for populating a dropdown list with data from the backend and selecting the desired value using Angular

I am currently working on an Angular 8 application that utilizes Material design. My goal is to populate a dropdown list with data retrieved from the backend. The API call code snippet is as follows: returnQrCodes$ : Observable<QRCodeDefinitionSelect ...

jQuery Datatables Ajax request breaks after initial execution

In my code, I have implemented a datatable as shown below: var dt = $("#reservations").DataTable( { columns: [ { data: "ReservationStart", render: function (data) { return $.format.date(data, "d MMM, yyyy h:mm a"); } }, { data: "Covers" }, { data: "id", re ...

Is there a way to display an image in a React Native app using data from a JSON file?

I am currently working with JSON content that includes the path of an image. I need to display this image in my React Native application. What is the best way to render this image? {"aImages":[{"obra_path":"http:\/\/uploa ...

The sorting functionality in Angular.js using the orderBy directive seems to be malfunctioning as it is not

Within this code snippet, @Model.jsonString represents a string. @model WebApplication1.Models.Car @{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Layout.cshtml"; } <html> ... <body ng-app="myModule"> <div ng-controller="myC ...

Tips for managing the barrage of frameworks and updates in the world of JavaScript without feeling overwhelmed

Initially, I immersed myself in HTML, CSS, and JavaScript (specifically es5). I believe I have a solid grasp of the basics such as event loop, hoisting, closure, and binding. Moving forward, I delved into jQuery and PHP. Eventually, I ventured into framew ...

An angular component that is functioning properly when connected to a live server, however, it is experiencing issues when trying to run `

I tried integrating versitka into my Angular component by placing the version HTML file and all necessary assets in the appropriate directories. However, when I run ng serve, only the HTML file seems to be working, while the CSS and images fail to load. I ...

The most effective method for transferring asynchronous data to pages in Next.js

My current directory structure: - components - NavBar - Header - Layout - pages - pages - demo.js - _app.js - index.js // index.js import React from 'react'; import NewLayout from "../../components/NewLayout/NewLayou ...

Navigating to the bottom of a page once an element is displayed (with react-slidedown)

I'm facing a bit of a challenge here that I haven't been able to resolve yet. So, I have this optin form that is revealed upon clicking on a link. The reveal effect is achieved using react-slidedown. The issue I'm encountering is that when ...

Maintain the structure of ajax POST requests and display a real-time feed of

I've been developing an openvz script to run virtual machines at home. I've been exploring JavaScript and AJAX functions to send post requests, which are then displayed in the innerHTML section of my webpage. However, I've encountered an iss ...

SignalR gets stuck on the 'Initiating start request' screen, halting all progress

SignalR has been causing some strange behavior for me lately. After doing some refactoring, I started experiencing connectivity issues. It seems like my code was just lucky to work before because it didn't follow the recommended practices. For example ...

Problem encountered when trying to generate a custom-shaped div with a width set to 100

I am currently working on creating a diagonal div at the bottom of another div. I want it to have a design similar to this: . I encountered an issue when I tried adding a 100vw value to my border-left, as it caused a horizontal scrollbar to appear on my w ...

Switching ng-Idle countdown time from seconds to minutes is possible by adjusting the configuration settings

I have implemented ng-idle in my application, where the warning popup appears after 10 seconds with the message: "Your session will be close in 10 seconds" However, I need to change this to minutes. The session should be closed in 5 minutes instead. How ...

Troubles arise when trying to compile Typescript and React with esbuild

I set out to create a new package and upload it to npm, starting with a demo package first. I began by using this repository as a foundation: https://github.com/wobsoriano/vite-react-tailwind-starter After that, I made updates to the build script: " ...

Creating a radio button along with a submit button that redirects to a different local HTML file

Can someone please help with this code? I'm trying to redirect to the value of each radio button when it's clicked. Any guidance or JavaScript code would be greatly appreciated. Thank you. I've tried multiple solutions but none of them seem ...

Collect data from multiple input fields with ng-model

As a newcomer to angular, I am attempting to create a form with multiple input boxes that will capture user inputs. The number of input boxes is dependent on a dynamic JSON object. I am using an ng-repeat to generate the structure, but I am encountering ...

Utilizing Radio buttons for validation in react-hook-form

After creating a form with radio buttons and implementing validation using React Hook Form, I encountered an issue where the console always displayed "on" regardless of the selected radio button. <div className=""> <label ...

Ways to update a row in ui-grid?

I am attempting to refresh only the specific row that has been edited in the ui-grid without refreshing the entire table. My scenario involves editing a row in the grid, triggering a rest call, and then updating only that particular row in the grid. Upon ...