Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

864 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

25 Experts available now in Live!

Get 1:1 Help Now