October 5, 201312 yr Hi people, Ive never designed a website for moble devices before or one that uses a full blown background image. So please go easy on me.. Anyway, I have a full background image that i want to display on my site. Its working fine on all desktop browsers however when I test it on my iphone and ipad the image is slightly broken at the top and at the bottom. here is my (at the moment) very basic css code: body { font: normal .80em arial, sans-serif; color: #DDD; background-attachment: fixed; background-color: #FFF; background-image: url(../images/back.jpg); background-repeat: no-repeat; background-position: center; } Really gratefull if anyone can tell me what im doing wrong here. Thanks in advance.
October 5, 201312 yr u can use css media queries and use different sized bg image like this * Smartphones (portrait and landscape) ----------- */ @media only screen and (min-device-width : 320px) and (max-device-width : 480px) { /* Styles */ body {background-image:url('paper9.gif'); } /* Smartphones (landscape) ----------- */ @media only screen and (min-width : 321px) { /* Styles */ body {background-image:url('paper8.gif'); } /* Smartphones (portrait) ----------- */ @media only screen and (max-width : 320px) { /* Styles */ body {background-image:url('paper7.gif'); } /* iPads (portrait and landscape) ----------- */ @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) { /* Styles */ body {background-image:url('paper6.gif'); } /* iPads (landscape) ----------- */ @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape) { /* Styles */ body {background-image:url('paper5.gif'); } /* iPads (portrait) ----------- */ @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) { /* Styles */ body {background-image:url('paper4.gif'); } /* Desktops and laptops ----------- */ @media only screen and (min-width : 1224px) { /* Styles */ body {background-image:url('paper.gif'); } /* Large screens ----------- */ @media only screen and (min-width : 1824px) { /* Styles */ body {background-image:url('paper2.gif'); } /* iPhone 4 ----------- */ @media only screen and (-webkit-min-device-pixel-ratio : 1.5), only screen and (min-device-pixel-ratio : 1.5) { /* Styles */ body {background-image:url('paper3.gif'); }
October 5, 201312 yr Author Thanks Sash, Ive been playing around with it and seem to have itworking now, although I will try out the media queries you posted. Thanks for your help dude.
Create an account or sign in to comment