?
Solved

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

Posted on 2008-10-27
4
Medium Priority
?
626 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 1500 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

765 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