Make a full screen CSS background image appear behind a mobile keyboard

0 votes

I've set an HTML/CSS full-screen background image with:

html, body {
  background: url("background.jpg") no-repeat center center fixed;
  background-size: cover;
  overflow: hidden;
}

The background image looks good when viewed in a desktop browser or initially when viewed on a mobile browser. However, if I open the keyboard in the mobile browser then the image resizes to cover the space above the keyboard.

Instead of resizing, I'd like the image to appear to be "behind" the keyboard, and have the bottom portion of the image obscured. Avoiding resizing the image will make opening and closing the keyboard less jarring. Any suggestions how to achieve this?

I've tried setting the document.body.style.backgroundSize to the original window height after window resize events but that doesn't seem to impact the background image size at all.

Jul 18 in CSS by Edureka
• 9,760 points
6 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In CSS

0 votes
1 answer

How do I give text or an image a transparent background using CSS?

Use either a semi-transparent PNG or SVG ...READ MORE

answered May 27 in CSS by Edureka
• 9,540 points
31 views
0 votes
1 answer

Position a CSS background image x pixels from the right?

The attribute border can be used as ...READ MORE

answered Jun 10 in CSS by Edureka
• 9,540 points
25 views
0 votes
0 answers

Fading in a background image using javascript or css on hover

I have so far been able to ...READ MORE

Jun 30 in CSS by Edureka
• 9,760 points
20 views
0 votes
1 answer

Is there any way to colorize a white PNG image with CSS only?

Filters can be used with -webkit-filter and ...READ MORE

answered May 27 in CSS by Edureka
• 9,540 points
63 views
0 votes
1 answer

When to use IMG vs. CSS background-image?

You can transition a div's background image ...READ MORE

answered Jun 10 in CSS by Edureka
• 9,540 points
42 views
0 votes
1 answer
0 votes
1 answer
0 votes
0 answers

Anyone can help me out to understand the semantic of (document.getElementBYId("demo").innerHTML="Hello") ?

Hello guys, Can Someone helps me to find ...READ MORE

Jan 17, 2020 in Web Development by anonymous
• 37,500 points
401 views
+1 vote
1 answer

What is the relationship between angularjs Scope with controller/view?

Let us consider the below block: <div ng-controller="emp"> ...READ MORE

answered Jan 20, 2020 in Web Development by Niroj
• 82,740 points

edited Jan 21, 2020 by Niroj 405 views
+1 vote
1 answer

What are pseudo class in css??

Hey, The state of an element is controlled  by ...READ MORE

answered Jan 20, 2020 in Web Development by Niroj
• 82,740 points

edited Jan 21, 2020 by Niroj 299 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP