How do I resize images on Android?
I'm trying to use my mobile.css file to resize images to 310px wide. This is working on the iPhone but not on Android.
How can I resize these images on Android?
Here's my page & CSS:
div.photosmall,
div.photosmall img,
div.photosmall a img,
div.photosmall-left,
div.photosmall-left img,
div.photosmall-left a img,
div.photosmall-right,
div.photosmall-right img,
div.photosmall-right a img,
div.photobanner,
div.photobanner img,
div.photobanner a img,
div.photolarge,
div.photolarge img,
div.photolarge a img,
div.photolarge-left,
div.photolarge-left img,
div.photol开发者_高级运维arge-left a img,
div.photolarge div.photolarge,
div.photolarge div.photolarge img,
div.photolarge div.photolarge a img,
img.photobanner,
img.photolarge {
width:310px !important;
float:none;
}
The first thing we need to check is that the CSS file really is being loaded. It looks like you're dynamically loading the CSS by using some JavaScript mobile browser detection functions. Are any other rules in mobile.css definitely taking effect? if you're not sure, try adding outline:solid 1px red
to your image style attributes for visible feedback. If there is still no effect, The script isn't doing its job, or Android is trying to emulate a desktop browser (and there may or may not be an option to change that).
As a side note, you specify the image width to be 310px wide, but the default style on the page says 300px. Are you sure you want to make the images bigger on a smaller screen?
It seems the images are already set by css, I guess it's fixed? If not, you probably need to clean your browsers cache
Are you able to provide a link to the page when rendered in Mobile view? And maybe a screenshot of what is wrong? One thing I did notice is that the image of Melissa Foley has a width="200" defined outside of the css.
The site looks perfectly fine on both my Nexus One 480x800 px and my LG Optimus One 320x480. I don't really see a problem.
精彩评论