Solved

How to write scripts to auto resize an image banner to fit browser screen

Posted on 2008-10-27
4
623 Views
Last Modified: 2013-12-24
Hey guys,
I am a database person and have limited skills in web development, I hope you guys can help me out here.  I am working on a webpage in MS Front Page, so far I have a top banner that is really long, so if I open up the page in a smaller screen, about 1/4 of the banner image will get cut off.

I don't know if there is any scripts that I can write in html or javascript that will automatically resize the top banner so that no matter how big or small user screen is, the full banner can still be displayed properly.

I only have this very basic html code right now =(
<img border="0" src="home.jpg" width="1493" height="376">
0
Comment
Question by:bluesky204
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 39

Accepted Solution

by:
Roger Baklund earned 500 total points
ID: 22817346
You can do it, but it will not scale in a pretty way... either like this:

<img alt="" src="home.jpg" width="100%" />

This will keep the aspect ratio. You can also keep the height fixed, like this:

<img alt="" src="home.jpg" width="100%" height="376">

(The border attribute is deprecated, and the alt attribute is required. See
http://www.w3.org/TR/html401/struct/objects.html#h-13.2 )
0
 
LVL 44

Expert Comment

by:scrathcyboy
ID: 22819043
The only pleasing way to do this is to edit the image in photoshop, or the free Irfanview, and rescale it to a width of 640 pixels (and matching height), and save that image and use it in a TD or DIV with the width of that TD or DIV as 100% -- to scale the image at 100% will look bad on most browsers.
0
 

Author Closing Comment

by:bluesky204
ID: 31510537
Thanks a lot!
0
 

Author Comment

by:bluesky204
ID: 22841331
Thanks guys, width=100% works for me as I decided to only strech the red lines below the picture so the only that changes with different resolution is the line, I just kept picture centred
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question