CSS: Card elevates when keyboard is activated on a mobile device

[view image 1[view image 2]

  • Image 1: Normal View,
  • Image 2: When the keyboard is enabled, the card jumps up and when I close it's normal.

Is this behavior normal? Or is there a fault in my CSS? I utilized styled-components for writing the CSS.

CSS

export const Container = styled.section`
  height: 92vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f5f5f5;
`;

export const Form = styled.form`
  display: flex;
  flex-direction: column;
  align-items: center;
`;

export const Card = styled.section`
  width: ${(props) => props.Width || '22rem'};
  height: fit-content;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  border-radius: 5px;
  box-shadow: 0px 2px 4px rgba(68, 47, 47, 0.5);
  background: white;
`;

export const Header = styled.header`
  min-height: 7vh;
  background: rgb(0, 5, 36);
`

Login.js

import React from 'react';
import {
  Card,
  Container,
  Form,
} from '../Styles/StyledProfile';
import TopHeader from '../Dashboard/Header';

function Login() {

return (
    <>
      <TopHeader />
      <Container>
        <Card>
          <Form>
          .....
          </Form>
         </Card>
        </Container>
      </>
   )

}

Answer №1

In my opinion, this behavior is typical. However, if you wish to avoid the login box appearing at the top of the header, you can apply the following CSS:

.main-container {
 min-height: 92vh;
 height: 100%;
}

.card-section {
  margin-top: 40px;
}

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

Tips for aligning an image and paragraph in the center of a table row using Material UI

I designed a table using material UI that includes images and paragraphs in the same row. However, I am facing an issue where they do not align at the same height as required for them to be centered in the row. Currently, the view shows a mismatch in heig ...

Error in React with Keycloak: Success function is not available in the response of kc.updateToken()

I recently worked on implementing keycloak authentication. Here is a snippet of my keycloak initialization configuration: const token = localStorage.getItem('kc_token'); const refreshToken = localStorage.getItem('kc_refreshToken'); e ...

Acquire row data when checkbox is selected in MUI X Data Grid

Utilizing React MUI X DataGrid, I am fetching data from an API and displaying it. Check box selection is enabled, and I want to retrieve specific cell items from the selected row and store them in a list. For example, if I click on the checkbox for the 1s ...

Utilizing PHP to create an interactive website

As a novice PHP developer, I took to Google in search of tutorials on creating dynamic PHP websites. What I found was that many tutorials used the $_GET variable to manipulate URLs and make them appear like this: example.com/?page=home example.com/?page= ...

What impact does utilizing CSS 3D Transforms have on search engine optimization (SEO)?

Google emphasizes the importance of not hiding content, as it may not be counted by search engines. However, Google Cache has shown some discrepancies in understanding certain elements correctly. It's possible that what Google perceives as hidden migh ...

The footer is not displaying at the bottom of the page in Firefox

While the footer design is functioning well in both Chrome and IE, it seems to be encountering issues with Firefox. div.footer{ width: 100%; padding: 0px; margin-top: 200px; font-size: 0.6em; line-height: 1.2em; clear: both; po ...

Problems arising from Jquery append functionality

When using the append method, my inner div is only attaching one WHEAT-COLORED-BOX, whereas when using appendTo, my inner div attaches all the required number of WHEAT-COLORED-BOXES. Therefore, in this case, appendTo gives the correct result while append f ...

I am looking to apply the flex-direction style to the Material UI Grid component

Looking to set the direction property for a <Grid container> component in the Material UI framework. After reviewing the documentation, I attempted setting the direction property as column with the following code snippet: <Grid container directio ...

Issue with Gmail failing to render CSS in HTML email (svnspam)

After successfully setting up and configuring svnspam, I noticed that the emails sent to my Gmail account are missing the colored diffs. When examining the original email using Gmail's view original feature, I found the CSS code as follows: <html ...

React Object Array Item State management

After spending a considerable amount of time on this task, I have been trying to achieve the functionality of changing a checked value upon checkbox click. Here is how my initial state is set up: const [todoList, setTodoList] = useState({ foundation: ...

Is there a way to set it up so that clicking on a small image will automatically switch to the corresponding larger size image?

For instance, I have 4 small images and 1 main image. When I click on a small image, the main image changes to display that selected picture. I was wondering if there is a specific value to place inside target=""? I prefer to only use HTML/CSS as I am no ...

Utilizing props in styled-components: A beginner's guide

I am trying to pass a URL to a component so that I can use it as the background image of the component. Additionally, I need to check if the URL is empty. Component: <BannerImg/> CSS (styled): `const BannerImg = styled.img` background-image: url( ...

Prevent the onClick event in the parent container div from triggering when clicking on a child element

Having trouble with event bubbling and onClick functions within a card element. The card has a heart icon that triggers an onClick function to unlike the card, but it also triggers the onClick function for the entire card which leads to a different page wi ...

By increasing the background-color to 100%, the list item obstructs the background image of its parent div

In cases where an element is set to display:block, the background-color of that element typically extends to 100% of the width of its parent element. However, I am seeking a solution where the background-color only reaches the edge of the text, allowing th ...

CSS: Continuous Automated Slide Transitions

What CSS code do I need to incorporate into my code to create a continuous Slider Animation? I want the pictures to slide automatically one by one, with a specified time interval between each slide when not on hover. The hover function is already included ...

Modify the input value when using the get_search_form() function in Wordpress

After experimenting with the latest get_search_form() function in WordPress, I've encountered an issue where I can't figure out how to remove the text label from the search submit button. Does anyone have any suggestions or solutions for this pr ...

What could be causing my React useState not to update my components?

My understanding of React might be lacking, but I am facing an issue with updating a Component after the state has been asynchronously updated. const [appState, setAppState] = useState({ countries: null, languages: null }) useEffect(() ...

Using both italic and regular text in an HTML (or ASP.NET) textbox can add emphasis and enhance readability for

Is there a way to achieve this using JavaScript? For instance, if the initial text is 'Axxxxxx', I want it to be displayed in a textbox with normal style for the first letter and italic style for the rest like 'A*xxxxxx*' If the initia ...

Access rendered elements within React

I am currently looking to incorporate this feature from Svelte into React. Is it possible to implement? For documentation, please refer to: ...

Assigning properties to the constructor using `this.prop`

Within a React class component, I have multiple methods and the component receives various props. I am contemplating whether I should assign each prop as this.propName in the constructor and then access them using this.propName. For your reference, below ...