Solved

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

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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Suggested Solutions

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
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…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

726 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