• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

Scaling an embeded image.

My knowledge of html and CSS is very limited so hopefully i can ask the question and you will understand.

I have attached an image that shows the html/css so hopefully you will have a clearer picture.

I have developed an application that displays a page of a document in a frame.   Until now this has been a pdf, and the page has been scales to fit its container - the frame.

But now i am rendering a png from the document server and i have found that it is not being scaled.   By usings IE's developer tools i can see that i can add "max-height:100%" as an attribute and the image scales correctly.

How can i add that attribute to the html?  Can it been added by the document server when it renders the png .i.e. can i add something that intructs the browers to display it a 100% the size of the window?  Or must i use some CSS, or what?

The problem...
  • 2
1 Solution
Julian HansenCommented:
You can set it with CSS

img {
  max-height: 100%

Except that will apply to all images

Or give your image a clas
<img src="..." class="someclass" ...

img.someclass {
   max-height: 100%

Although it should not be needed - images will by default assusme their natural height and width unless expressly told to do otherwise either directly or through a parent container.

Can you post a link to your code?
soozhAuthor Commented:

Did you look at the attached image?  That shows some code.

I tried both your solutions but the image did not scale, even when i used the first of your solutions.

I guess i must be doing something wrong
Bernard S.Commented:
You really need to paste the html et cess code (relevant parts) or provide a link to an online page so that your code fan be analyzed.

Note that wit IE in some cases if you want max-height to be used you also need to define other heights B-)
soozhAuthor Commented:
I have solved it now thanks.  Just added the height/width sizes to the img tag.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now