Resizing banner to fit viewer's browser resolution - how??

G

Guest

I need to be able to resize a title banner on a webpage so it always takes up
the same proportion of space relative to the browser resolution of the
viewer. If I'm hand-coding, I can do this - but neither me or my workmates
cabn get it to work in FrontPage at all? Can anyone out there help, please?
 
S

Stefan B Rusynko

If it is a graphic you shouldn't do it (stretch the graphic)
Better to center it and apply a complementary background color

You can find javascripts that will resize images (down) based on screen resolution, but differences in browsers and user window
sizes will often cause distortions
--




| I need to be able to resize a title banner on a webpage so it always takes up
| the same proportion of space relative to the browser resolution of the
| viewer. If I'm hand-coding, I can do this - but neither me or my workmates
| cabn get it to work in FrontPage at all? Can anyone out there help, please?
 
M

Murray

And consider this dilemma. My screen is 1280x1024. If you resize your
graphic to match that resolution, you will flummox my 720px wide browser
window into having a monster scrollbar.

See, resolution really has nothing to do with anything other than the
maximum width of your browser window. The problem is, you have no way of
determining that value until it is too late to do anything about it. So,
any attempt to adjust based on screen properties is misguided.

Stefan has the right idea with the complementary background color....
 
J

Jon Spivey

I still wouldn't agree with resizing the graphic but one can easily get the
viewport width instead of the resolution, we need to mess about a bit to get
it cross browser
<script>
var x
if (self.innerHeight) x = self.innerWidth;
else if (document.documentElement && document.documentElement.clientWidth) x
= document.documentElement.clientWidth;
else if (document.body) x = document.body.clientWidth;
alert(x) // 720px for you
</script>

This is usually much more useful than the resolution which is probably
meaningless for the reason you mentioned
 
M

Murray

Yes, but the problem is that you can only do that client side, which is
usually too late to do anything about the page width.
 
J

Jon Spivey

True - but you can only get the screen resolution client side too. The
point's probably moot because we're agreed this isn't a good idea any way
:)


--
Cheers,
Jon
Microsoft MVP
 
J

Jon Spivey

No - from memory IE used to send the screen res in a header something like
http_ua_pixels but this is going way back - I'm not sure it even still
does. In any case this won't help with any other browser. Don't go there
:)
 
M

Murray

I am already running.... 8)

--
Murray

Jon Spivey said:
No - from memory IE used to send the screen res in a header something like
http_ua_pixels but this is going way back - I'm not sure it even still
does. In any case this won't help with any other browser. Don't go there
:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top