Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Web and WebWorks Development

Reply
Trusted Contributor
chicoxml
Posts: 207
Registered: 09-03-2010

size of the images on screen

hello,

 

What would be the best practice for the images to be displayed the same size, regardless of the size of the display device.

 

Please use plain text.
Developer
colforbin13
Posts: 16
Registered: 03-21-2011
My Carrier: AT&T

Re: size of the images on screen

I think BB recommends using the "em" units, but in my experience, it doesn't scale that well to smaller devices, and I find percentages to work better.  If you do something like this

<img src="images/image1.png" width="5%" />

your image will take up 5% of the available width of the screen, and the height will be scaled proportionally.  That way, no matter how wide or narrow your display is, the image will still be the same relative size.

Please use plain text.
Trusted Contributor
chicoxml
Posts: 207
Registered: 09-03-2010

Re: size of the images on screen

Thanks, I'll try using this

Please use plain text.
Trusted Contributor
chicoxml
Posts: 207
Registered: 09-03-2010

Re: size of the images on screen

this code does not work, the image is reduced to shorter

Please use plain text.
Contributor
TheWakeUpCall
Posts: 48
Registered: 03-30-2011

Re: size of the images on screen

Reduced to shorter? I'm not sure I understand what you mean.
Please use plain text.
Trusted Contributor
chicoxml
Posts: 207
Registered: 09-03-2010

Re: size of the images on screen

yes, the image is reduced

Please use plain text.
Contributor
TheWakeUpCall
Posts: 48
Registered: 03-30-2011

Re: size of the images on screen

Do you mean on every screen size you want the image to be the same size exactly (not relative to the screen size), e.g. 200x200 px? In this case you just set that as the width (like 200px).
Please use plain text.
Trusted Contributor
chicoxml
Posts: 207
Registered: 09-03-2010

Re: size of the images on screen

exact, I want the image is the same size regardless of screen size.

 

sorry my English is not very good

Please use plain text.
Contributor
TheWakeUpCall
Posts: 48
Registered: 03-30-2011

Re: size of the images on screen

In your css do:

#id-of-img {
width: 200px;
}

replacing the id with your image's actual id that you chose.
Please use plain text.
Trusted Contributor
chicoxml
Posts: 207
Registered: 09-03-2010

Re: size of the images on screen

does not work, I'll prepare a demo so they can see what happens

Please use plain text.