The form container lacks responsiveness

I'm working on designing a signup form with a background consisting of two different colors. The signup form should be positioned just above the background and centered. However, I've encountered issues with responsiveness, especially on mobile devices. For mobile design, I want a simple signup form without the background. It's possible that my positioning techniques (relative, absolute) are causing the problem.

Here is the code snippet:

.signup-form {
  width: 100%;
  min-height: 100vh;
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  background: #f2f2f2;
}

.signup-wrapper {
  width: 100%;
  background: #6493f3;
  overflow: hidden;
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  flex-direction: row-reverse;
}

.left-block {
  width: calc(100% - 560px);
  background: #6493f3;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  z-index: 1;
  &::before {
    content: '';
    display: block;
    position: absolute;
    z-index: -1;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.1);
  }
}

.right-block {
  width: 560px;
  min-height: 100vh;
  display: block;
  background-color: #f7f7f7;
  padding: 50px 55px 55px 55px;
  position: relative;
}

form {
  background: #fff;
  box-shadow: 0 1.5px 0 0 rgba(0, 0, 0, 0.1);
  position: absolute;
  top: 120px;
  left: -100px;
  width: 450px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px;
}

.caption {
  width: 100%;
  display: flex;
  font-size: 30px;
  color: #444;
  line-height: 1.2;
  text-align: center;
  padding: 20px;
  flex: 1;
  justify-content: center;
  align-items: center;
}

.form-field {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  margin-bottom: 2rem;
}
<div class="signup-form">
  <div class="signup-wrapper">
    <div class="right-block">
      <form>
        <span class="caption">Create An Account</span>
        <div class="form-field">
          <input type="text" placeholder="Full Name" />
        </div>
        <div class="form-field">
          <input type="email" placeholder="Email" />
        </div>
        <div class="form-field">
          <input type="password" placeholder="Password" />
        </div>
        <div class="form-field">
          <input type="text" placeholder="Country" />
        </div>
      </form>
    </div>
    <div class="left-block">
    </div>
  </div>
</div>

You can view the JSBin file here

Update:

This is the desired layout I'm aiming for:

https://i.sstatic.net/UP7vL.png

Answer №1

.register-form { 
  width: 100%;
  min-height: 100vh;
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  background: #f2f2f2;
}

.register-wrapper{
  width: 100%;
  background: #6493f3;
  overflow: hidden;
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  flex-direction: row-reverse;
}

.left-section{
  width: calc(100% - 560px);
  background: #6493f3;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  z-index: 1;
  &::before {
    content: '';
    display: block;
    position: absolute;
    z-index: -1;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.1);
  }
}

.right-section{
  width: 50%;
  min-height: 100vh;
  display: block;
  background-color: #f7f7f7;
  padding: 0;
  position: relative;
}

form {
        background: #fff;
box-shadow: 0 1.5px 0 0 rgba(0, 0, 0, 0.1);
position: absolute;
top: 120px;
left: 0;
max-width: 450px;
display: flex;
flex-direction: column;
justify-content: center;
padding: 20px;
z-index: 99;
right: 0;
margin: auto;
width: 75%;
}

.heading {
  width: 100%;
  display: flex;
  font-size: 30px;
  color: #444;
  line-height: 1.2;
  text-align: center;
  padding: 20px;
  flex: 1;
  justify-content: center;
  align-items: center;
}

.field {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  margin-bottom: 2rem;
}
<div class="register-form">
  <div class="register-wrapper">
     <form>
        <span class="heading">Register An Account</span>
        <div class="field">
          <input type="text" placeholder="full name" />
        </div>
        <div class="field">
          <input type="email" placeholder="email" />
        </div>
        <div class="field">
          <input type="password" placeholder="password" />
        </div>
        <div class="field">
          <input type="text" placeholder="country" />
        </div>
      </form>
    <div class="right-section">
     
    </div>
    <div class="left-section">
    </div>
  </div>
</div>

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 best way to format the JQGrid table for better

Is there a way to indent the table in this example and create white space on the side of the rows and header? I want a white margin on the left of everything below "Stackoverflow example". I'm hoping to achieve this using only CSS. Below is the code ...

Creating a persistent gap BETWEEN li inline list items

I'm seeking a solution to create horizontal links using a list. I know that I need to apply the display: block property to the ul element and set display: inline for the li items. While there are several inquiries about maintaining a consistent width ...

"Illuminating the way: Adding a search bar to your

Looking to enhance my WordPress blog with a search bar, I opted for a generic HTML approach over using get-search-form(). Here is the code snippet from my theme: <div class="input-group"> <input type="text" class="form-c ...

Trouble with triggering HTML5 FileReader() functions

I'm having trouble determining why neither readSuccess() nor readFailure() are being executed in the code snippet below: function readMyFile(){ var reader = new FileReader(); reader.onload = readSuccess; reader.onerror = readFailure; ...

Can CSS be used to consistently position content in a specific manner?

I previously inquired about a similar issue and received an excellent solution. Here is my jsbin http://jsbin.com/nuwagibayo/1/edit?html,css,output where I encountered the following scenario: The positioning of 12.50 seems slightly awkward in its current ...

Concealing the rear navigation button within the material carousel

I have a material css carousel, and I am trying to hide the back button on the first slide. I attempted to use the code below from a previous post The following code snippet prevents the user from looping through the carousel indefinitely. Stop looping i ...

Center align the paragraphs with an increasing line length for each line

Is there a way to align a paragraph while increasing the length of each line in a consistent manner? Here is an example from sampleFile.html: <div className="copyright-text"> <p>Can we align a paragraph in a way that the length of each li ...

Differences in CSS between IE10 and Chrome are causing compatibility issues

Website in question: What is causing the difference in display between IE 10 and other browsers? The website appears to function correctly on Chrome: IE 10: ...

Should elements be concealed with CSS if they cannot be eliminated with php?

There are times when I struggle to deactivate a function or elements in PHP, particularly in PHP frameworks and CMSs. As a workaround, I often utilize display: none. However, I am concerned about potential issues this may cause in the future. Should I co ...

Position the label to the right and left of the input field for alignment

I've been struggling to create an input form with labeled using a dl, dt, dd list. I want the first label on the left, the second on the right, and the input in the center. However, no matter what I try, I can't get the second label to align corr ...

What is the best method for utilizing the jQuery Selector in this particular web application?

I have been attempting to figure out how to select a delete icon within my personal web application. delectIcon HTML <main> <div class="container"> <div class="tabs"> <a href=""><p><span class="act ...

Circular graphs displaying percentages at their center, illustrating the distribution of checked checkboxes across various categories

Looking for a JavaScript script that displays results in the form of circles with percentage values at their centers, based on the number of checkboxes checked in different categories. The circle radius should be determined by the percentage values - for e ...

It is not possible to recycle a TinyMCE editor that is embedded in a popup

Having a frustrating issue with the TinyMCE Editor plugin embedded within a Fancybox pop-up window. I have a list of objects with Edit links that trigger an AJAX call to retrieve content from the server and place it in a <textarea>. A TinyMCE editor ...

Tips on how to eliminate focus after choosing a radio button in Angular Material?

This is a snippet from my HTML template file, which includes two Angular Material radio buttons. My goal is to disable the focus on the rings quickly after selecting any radio button. <div id="login-form" class="vh-100 overflow-auto" ...

What is the process for including or excluding a class from a horizontal scrollbar?

I've been trying to implement a back to top button on a horizontally scrolling page. However, I'm encountering difficulties in adding or removing the necessary class to show or hide the button. Here's the JavaScript code I'm using: $( ...

Issue with jQuery functionality when page is loaded through AJAX request

My index page currently has jQuery and a js file for a slider plugin loaded. I am using an on click event to load an external page using .load. Here is the code snippet: //jQuery loaded from Google CDN here (in head) jQuery( document ).ready(function() { ...

Build a photo carousel similar to a YouTube channel

Is there a way to create an image slider similar to the one on YouTube channels? I've noticed that when there are multiple videos on a channel, YouTube displays them in a slider with back and forth buttons to navigate through the videos that aren&apos ...

Extracting null data from web scraping using Python and Beautiful Soup

I'm currently facing challenges with extracting the correct values from a website that provides prices for Silver, Gold, Palladium, and Platinum. You can find the website here. Below is the HTML structure of the website: <div id="header-tab ...

Troubleshooting issues with the sidebar navigation in Laravel project using Vue and AdminLTE

I successfully installed AminLte v3 via npm in my Laravel + vue project and everything is functioning properly. However, I am facing an issue when I attempt to click on the main menu item in the Side navbar that is labeled as <li class="nav-item has-tr ...

Trouble arises with the right-to-left alignment of the drop down in the <select> form within the Ionic

I have been struggling with an RTL form issue, specifically with the <select> element. Despite successfully making all labels and inputs RTL, the <select> dropdown appears on top of its label. I have spent hours attempting to position it to the ...