What could be causing the inability to apply CSS to customize form content?

I've just wrapped up creating a sign-up form, but I seem to be having trouble utilizing display:inline-block. What could possibly be the issue?

The internal elements are stubbornly glued together and refuse to budge.
(On another note, any suggestions on different techniques to center a div in the middle of the screen would greatly help!)

Take a look at the code:
JavaScript snippet:

import React from 'react'
import './signup.css';
import { Outlet } from 'react-router-dom'

function Signp() {
  return (
    <div className='signupcontainer'>
        <form className='signup'id='signup'>
        <fieldset>
            <h1 >Sign-Up</h1>
        <section>
            <div className='FN'>First Name
            <label><input type='text' name='FNi' id='inp' required/></label></div>
            <div className='LN'>Last Name
            <label><input type='text' name='LNi' id='inp' /></label></div>
            <div>
                <label>Ph.no / E-mail</label>
                <label><input type='text' name='em/no' id='inp' pattern='[0-9]{3}-[0-9]{3}-[0-9]{4}' required/></label> 
            </div>
            <div>
                <label>password</label>
                <label><input type='password' name='pas' id='inp' required/></label>
            </div>
            <div>
                <label>Re-enter password</label>
                <label><input type='password' name='repas' id='inp' required/></label>
            </div>
            </section>

            <div>
                <label>Gender</label>
                <br/>
                <label><input type='radio' Name='gen'/>MALE</label>
                <label><input type='radio'Name='gen'/>FEMALE</label>
                <label><input type='radio' Name='gen' />OTHERS</label>
            </div>
            <label><input type='button' name='submit'value='Submit' required/></label>
            </fieldset>
            </form>
            <Outlet/>
    </div>
  )
}

export default Signp

CSS Code:

.signupcontainer{
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

#signup{
    border: 2px solid black;
    padding: 0.5rem;
    margin: 54px;
    width: 500px;
    display: inline-block;
    align-items: center;
    
}
.signup h1{
    justify-content: center;
    text-align: center;
    font-size: 30px;
}

#inp{
    display: inline-block;
}

Answer №1

It seems like there is some confusion regarding the specific issue at hand. If you are looking to center the signupcontainer both vertically and horizontally, you will need to use a wrapper element.

To achieve this using flexbox:

.wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
}

If you prefer using grid instead:

.wrapper {
  display: grid;
  place-items: center;
}

Another option is to use absolute positioning:

.wrapper {
  position: relative;
}
.signupcontainer {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

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

Two airplanes in such close proximity to each other

Currently dealing with an issue involving two planes positioned very closely together. One of the planes is causing glitches or disappearing from certain angles. Check out the following code snippet: var renderer, scene, camera, controls, mesh; init(); ...

Using React.js and TypeScript to leverage a single component for both <input /> and <textarea /> elements

After developing an <Input /> component with helper components for improved usability and code reduction within the main component, I encountered an issue while attempting to create a <textarea /> HTML element. The problem arises from using Rea ...

Conceal a column within a nested ListView

I am facing a challenge with nesting ListViews where I need to hide a specific table column in the inner ListView based on a certain parameter value in the URL. Specifically, I want to hide the ID column (both header and data) when the URL contains "...? ...

`Localhost JSON parsing works fine, but encounters issues on the server``

Although there are many questions about json, none of them seem to answer my specific question. I have a part of my Symfony2 controller that is sending me data. return $this->createResponse(array( 'result' => $users )); die ...

Modify the appearance of the element that is currently chosen

I have a navigation menu and I would like to change the style of the element that is selected from the list in the navigation menu. I am using React with the Grid element from material-ui. NavigationMenu.tsx: import React, { useState, useEffect } from "r ...

The useCallback function is not producing the desired outcome in my code

Upon reviewing the code, it is expected that the useCallback hook triggers the display of the message 'rerendering has happened!' only when typing in the input field, and not when clicking on the Toggle button. However, the message does appear fo ...

modifying CSS of a div element on a designated page position

A unique code snippet that I have positions a button fixed to the top of the page, causing it to overlay content or images as the user scrolls the page. HTML <div id="btn">button</div> ... images ... ... content ... CSS #btn { positio ...

Ensuring a Fixed Delta Tooltip in lightweight-charts is essential for maintaining a seamless

I have implemented lightweight-charts to present a chart using mock data. I am looking to establish a fixed Delta Tooltip on the chart when the page loads, with predetermined start and end dates that are specified as input. Furthermore, I aim to restrict t ...

Can someone please explain how to include a custom icon on Select component in Mantine without using an image from Tabler Icons library?

Hey there, I'm new to using Mantine and I'm currently working on a Search Component. Instead of utilizing an image from the tabler icons like in the Mantine examples, my goal is to include a picture from my own assets. Here's what I've ...

Attempting to run driver.execute_script(gooogletag but no response was received

I have been attempting to receive responses in the console from the browser when running googletag parameters with Selenium, but unfortunately I have not been successful. Even after trying .execute_async_script('googletag.pubads()') and putting ...

Steps for making a Three.js 3D line collection with specified width and thickness

Is there a way to create a Three.js 3D line series with customizable width and thickness? Although the Three.js line object does have a linewidth attribute, it is not universally supported across all browsers and platforms in WebGL. Here is how you can s ...

retrieve the current page/url using an attribute selector

I've been attempting to format a text menu in my CSS so that the link matches the current URL, but it doesn't appear to be working. Here's the code snippet: #pages.tabs ul li a[href$=location]{color:blue !important;} , where #pages.tabs ul ...

What impact does CSS scaling transform have on the flow of a document?

I'm really confused about the impact of scaling an element using CSS transforms on the document flow. Take a look at this jsbin or this codepen (since jsbin seems to be down), where I have set up the following structure: p{slipsum text} #scaled #s ...

Error Encountered: Anticipated 'styles' to consist of a series of string elements

I have attempted various solutions for this particular error message without any success. When launching my angular project using the angular cli via ng serve, everything runs smoothly with no errors. However, upon compiling it with webpack, I encounter th ...

Identify the Presence of Hover Functionality

For a while now, the trend has been leaning towards feature detection. I am interested in determining whether a visitor's browser supports the :hover pseudo class. With many mobile devices not supporting hovering, I want to adjust my event listeners a ...

Avoid reloading the page when the form is submitted using form.trigger('submit') command

My current code functions properly when the user clicks on the form's submit button: // load dashboards when filter form is submitted $('div.active form.filter-form').submit(function (e) { // get subm ...

Differences between HTTP request errors and response errors(Note: This

Currently, I am researching $http interceptors and noticed that there are requestError and responseError functions available. 1) Can you explain the distinction between requestError and responseError? 2) Under what circumstances does requestError get t ...

When the icon is clicked, initialize the jQuery UI Datepicker

Here is the code I am working with in a Backbone view: <input type="text" id="fromDate" name="fromDate"/><a id="cal"> <img src="img/calendar.gif"></a> Within the view's JavaScript file, I have implemented the following: defi ...

Unchecking a box becomes impossible in Rails and Ajax due to boolean constraints

Even though I've come across several similar questions, I'm still struggling to make mine work correctly. Here's what my code looks like... #app/views/tasks/index.html.erb <%- @tasks.each do |task| %> <div class="task-wrapper"> ...

Employing forward slashes as the template delimiter in JavaScript for HTML

let a = 1.10; let html = '<div>'\ '<strong>' + a + '</strong>\ //error here </div>'; console.log(html) Can you identify the issue in the code above? The intention is to insert a variab ...