I am developing jQuery Mobile page in which my CSS is
.ui-content {
background: transparent url('./images/bg.jpg');
background-size : 100% 100%;
min-height: 100%;
color:#FFFFFF;
text-shadow:1px 1px 1px #000000;
}
but page displays like this
I don't want that empty space between content and footer content height till the footer
With pure CSS works fine for portrait pages. You must set top and bottom position depending of your header and footer height
Pure CSS solution
Full Screen:
Fixed Toolbars (header/footer):
Floating Toolbars:
You can achieve "height 100%" with CSS only. Add the following to your ui-content selector:
Tested on jQuery Mobile v1.4.3
This is just to add a couple of points to @Omar's answer.
Put his scaling code inside a function and add scroll(0,0) to the top. This eliminates weird issues that can come up during orientation changes (portrait to landscape) on some devices.
The function should then be called on pagecontainershow (pageshow if jQM 1.3) and you should add a handler for window resize and orientationchange to keep the content properly sized when the viewport size changes:
I change @ezanker 's answer.
It works, but if I have two pages, page 2 will resize when I go to page 2 from page 1.
And if I change event
pagecontainershow
topagecontainerbeforeshow
, it does not work correctly.I debug and find height of header or footer is wrong before show.
code
the simple answer isn't in resizing the content div but in changing the background color of the active page like this...
...to match the color of the ui-content and all of a sudden the problem goes away.