0

I am trying to center text and images inside a FRAME, but can only get horizontal centering to work.

I'd like to have the text I display in the frame be both horizontally and vertically centered.

I do not know the size of the frame (it's the "*" from the FRAMESET definition).

In another instance, I'd also like to have an image centered both horizontally and vertically, preferably also resized (keeping aspect ratio) to fill the FRAME area.

I know that FRAMESET is deprecated, but that's what I have to work with at this time. If you really want, you may answer with a (complete) setup that ends up with the same capabilities using non-frames, but that's beyond my knowledge at this time...

My FRAMESET definition is as follows:

  <FRAMESET ROWS="50,*,110" BORDER=0>
    <FRAME SRC="...">
    <FRAME SRC="..." NAME="FullSize">
    <FRAME SRC="...">
  </FRAMESET>

It's an Image Viewer part of the web site. In the top FRAME is a "return to parent" link, and the bottom FRAME contains a horizontally scrollable list of thumbnails, which - when clicked - shows the image in full-size in the center FRAME. When first shown (before the first thumbnail click), I'd like a text neatly centered in the center FRAME that shows some information.

EDIT:

The bottom frame is a series of

<A HREF="ViewImage.asp?ID=###" TARGET="FullSize"><IMG SRC="GetThumb.asp?ID=###"></A>

The ViewImage.asp currently emits a simple html page with this structure:

<HTML>
<BODY>
<IMG SRC="Image###.PNG" ALIGN="CENTER">
</BODY>
</HTML>

What other elements/styles need to be in this ViewImage.asp output to also center it vertically, and if possible, resize it to fill the frame while maintaining aspect ratio?

The top frame is simply an

<A HREF="MasterPage.asp" TARGET="_top">Back to parent</A>

The middle frame, as I said, is the one I need help with. How do I center a text and/or an image (both vertically and horizontally) within that frame, given that I know neither the height nor the width of that frame? And - if possible - how do I ensure that the image in the frame is enlarged/shrinked to fit the size of the frame while keeping the aspect ratio intact?

EDIT 2:

Only partially solved. The centering now works, but not the optimal fitting to the frame size...

HeartWare
  • 7,464
  • 2
  • 26
  • 30
  • Why the close votes? What is it that "doesn’t meet a Stack Overflow guideline." ??? – HeartWare Feb 20 '22 at 10:24
  • frameset is deprecated as of HTML5 and forward. You should look at another way of markup. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/frameset there is also too little markup to go with along with 0 CSS. You mention an image viewer etc. etc. We don't know the full behavior. Something might be affecting something else etc. – Martin Feb 20 '22 at 11:27
  • @Martin: I'd gladly go with another markup, but I don't know what that would be - hence my question. Regarding the full behaviour, it not that complicated, but I'll try to elaborate in the quetsion. – HeartWare Feb 20 '22 at 11:51
  • Thank you for the link to the other question, whoever that was, and it solves the centering problem. But how do I make the image fill the entire frame? If I implement the above and the image is smaller than the frame, it's centered nicely. If it's bigger, it overflows. In the first case, I'll like the image enlarged, and in the second, I'd like it shrunk. I have tried experimenting with WIDTH="100%" but that makes it half-size and centered. WIDTH="150%" makes it the right size, but then it is aligned along the right-hand-side... – HeartWare Feb 20 '22 at 17:48

0 Answers0