Solved

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

Posted on 2008-10-27
4
609 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
  • 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…

762 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now