Certain div elements remain at the forefront, positioned above the page

The content in the div columns is extending out of the page, especially when there are a lot of items. Instead of expanding downward as expected, it expands upward.

Code Snippet:

var timesClicked = 0;
document.getElementById('add').addEventListener("click", () => {
   // code goes here
})
document.getElementById('previous').addEventListener("click", () => {
   // code goes here
})
for (let i = 1; i <= 12; i++) {
   document.getElementById(`input${i}`).addEventListener("input", () => {
       document.getElementById(`div${i}`).innerHTML = document.getElementById(`input${i}`).value
   })
}
// CSS code goes here
<form action="registerNewUser.php" method="post" accept="utf-8" id="form" onsubmit="return confirm('Are you sure you want to add this profession')">
   // form HTML code goes here      
</form>

I have been trying to troubleshoot for several hours but haven't been able to identify the specific issue in the CSS causing the problem. Seeking assistance to resolve this issue.

Answer №1

The primary issue seems to stem from the fact that you are centering the form using the body css.

To address this, try removing justify-content: center; from the body css and opt for a more moderate margin like margin: 5em;. This adjustment should resolve the problem you're facing.

Your updated css file will appear as follows:

html,
body {
  box-sizing: border-box;
  height: 100%;
  display: flex;
  flex-direction: column;
  /* justify-content: center; REMOVED */
  align-items: center;
  background: #95afc0;
}

form {
  box-sizing: border-box;
  height: 100%;
  width: 80%;
  margin: 5em; /* MODIFIED from 20em */
  padding: 5em;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border: 1px solid rgba(0, 0, 0, .1);
  box-shadow: .1em .1em .2em .1em rgba(0, 0, 0, .1);
  background: #fff;
  border-radius: .3em;
}

form input[type="button"],
form input[type="submit"] {
  font-family: calibri;
  bottom: 1em;
  right: 1em;
  padding: .7em;
  margin: 1em 0;
  border: none;
  color: #fff;
  font-size: 1.35em;
  background: #0984e3;
  border-radius: .2em;
  outline: none;
  cursor: pointer;
  transition: .2s;
  font-weight: 300;
}

... (Remaining content continues) ...

.container>div {
  padding: 10px;
  display: flex;
  align-items: center;
  flex: 1;
}

I trust this resolution is useful. If not, please feel free to inform me.

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

How can I utilize CSS to dictate color schemes on an HTML5 canvas element?

Currently, I am working on a checkers project where the first step is to create the initial board. The way we are currently implementing this has raised a philosophical concern. We are using the fillRect function to define the color of the "dark" squares a ...

Mysterious behavior in JavaScript causes it to skip the second index of an array

Below is a lengthy snippet of html code that I would like to discuss: <!DOCTYPE html> <html> <head> <script type = "text/javascript" src="http://code.jquery.com/jquery-1.8.0.min.js"></script> <script> $( ...

When a user clicks on an image, I would like to dynamically resize it using a combination of PHP

Although I have a good understanding of CSS and HTML, my knowledge of Javascript is limited. I am looking to add an interactive element to my website where an image enlarges gradually when clicked and smoothly moves to the center of the screen in one con ...

My custom class is being ignored by Tailwind CSS within breakpoints

I'm attempting to incorporate some animation on the height property within the md breakpoint, but for some reason Tailwind CSS isn't applying my class. <div className={`h-12 bg-blue flex w-full text-white fixed mt-1 md:bg-white ${scrolling ? ...

How can I limit user access to web content in Django with a daily usage allowance?

I am the administrator of an online pricing website built with Django. My goal now is to limit access to price information for non-VIP users. I want to implement a system where non-VIP users can only view prices on my website up to 3 times per day after l ...

Unable to reposition 'Select' element in ASP.net

Recently, I attempted to implement Bootstrap Dual Listbox for my project after finding it at this link: . However, I encountered an issue where the dual-list box consistently aligned to the left and I struggled to change its alignment. Despite trying to ad ...

Lose yourself in the horizontal beauty of the CSS menu

Currently, I am working on an application using ASP.Net MVC4, jquery 1.9, and CSS 2.1. However, I have encountered an issue with the horizontal menu display. Whenever a form with a jquery component is shown, some buttons seem to disappear behind the menu, ...

HTML: Hover effect does not work for icons when hovered alongside anchor elements within a list item

I wanted to add a special effect to my navigation list items: When the mouse hovers over the anchor tags of the list items (or even in the active state), I wanted the image in the <span> to be replaced with a colored version of the image. The color o ...

Altering the style of the underline for a hyperlink

I'm looking to customize the underline style when hovering over a link. Specifically, I want to change the color and size of the underlined link. const useStyles = makeStyles(theme => ({ button: { marginLeft: theme.spacing(2), }, }) ...

box-sizing with child elements

I've been dealing with a frustrating issue all day. I'm trying to adjust the size of a child object to take up 100% of the parent, but with a margin of 10px using the box-sizing method. I know that I can set the parent's box-sizing property ...

Expanding the iWebKit Page Slider with Javascript

Does anyone have a suggestion for a page slider that mimics the look of native apps on iWebKit? I'm looking for something in Javascript that is simple to integrate and will provide a smooth transition between pages. ...

The functionality of reordering columns, virtual scrolling, and resizing the grid in jqgrid are not functioning properly

Implementing jqgrid with Symfony to display a datagrid has been a challenging task for me. Thanks to Oleg's insightful response, many of the major issues have been resolved. Below is a snippet of my code: <link rel="stylesheet" type="text/css" ...

Issue with Bootstrap4 toggler malfunctioning and not displaying links upon resizing the page

My Bootstrap navbar isn't displaying the links when I click the hamburger menu after resizing the window. Here's the code snippet: <div class="fixed-top"> <nav class="navbar navbar-dark navbar-expand-lg cusSticky&q ...

Looking to relocate logo placement within WordPress website

I'm struggling with aligning my logo on a WordPress page. I want the logo to match the height of the store hours section on the right and be aligned with the left border of the ribbon. Check out my PHP snippet: <!-- Favicon --> <lin ...

What is the best way to ensure a button can only be clicked once?

Can anyone help me figure out how to create a button that becomes disabled after being clicked once? I've searched but couldn't find any information on this. ...

Customized validation message in Angular Formly with live data

I'm currently working with angular-formly and attempting to create a validation that checks if the user input falls within a dynamically set range of two numbers. I thought the simplest way to achieve this was by using a few variables, and while the v ...

Add some styling to the dropdown option element using CSS

My dropdown menu appears like this:- <select id="fruits"> <option value="-1">Select</option> <option value="1">Banana</option> <option value="2">Apple</option> <option value="3">Grapes</op ...

Looping through a jQuery script to add a class if a certain condition is met in another class

$(document).ready(function() { if ($("#grid .media-box").hasClass("brand1")) { $("#grid .media-box-content").addClass("brand01") }; } }); and in body looping div grid <div id="grid"> <?php foreach($data as $items) { ?> <div cl ...

Ensure that the child div with a background color extends all the way to the bottom of its parent div

Having trouble getting two divs inside another one to stretch to the bottom without cutting off content? The goal is for both divs to adjust in height based on whichever one is longer, filling the outer div completely. When the left div (menu) is longer t ...

Is it possible to store CSS and JS files within an Android app that utilizes a webview, similar to Phonegap

Looking to store CSS and JS files for an Android app that utilizes a webview. Want to avoid repeated server requests by storing the files locally on the phone, similar to how PhoneGap operates. Are there any resources or documentation available to help a ...