Solved

Picture resizing with browser

Posted on 2007-04-06
4
132 Views
Last Modified: 2010-04-09
All I want to do is make it so that this picture is the as big as the browser.  No bigger and no smaller.  When the user shrinks the browser the picture should shrink.  Here is my code:  

<body bgcolor="#c0c0c0" style="margin:0px;">
<img src="images/beach-pictures.jpg" align="middle" width="100%" height="100%" />
</body>

It works perfectly when I view it with my Mac, but when its viewed on a PC it picture is larger than the screen so the user has to scroll down.  Then if the user shrinks his browser the picture stays the same size and does not shrink with the browser.  

All I want to do is create a page with one picture and nothing else.  No borders, no text, nothing else.  Please help.  I know this is easy but i need this to work asap.  THanks again.
0
Comment
Question by:trifecta2k
  • 2
  • 2
4 Comments
 
LVL 30

Expert Comment

by:Steggs
ID: 18867810
Hello trifecta2k,

Try this;

<html>
<head>
* {padding:0;margin:0;}
html, body, img {height:100%;width:100%;}
</head>
<body>
<img src="images/beach-pictures.jpg" />
</body>
</html>
Regards,

Steggs
0
 
LVL 5

Author Comment

by:trifecta2k
ID: 18867851
I'm getting a syntax error.  Everything you have in the <head> shows up as text in IE.
0
 
LVL 30

Accepted Solution

by:
Steggs earned 500 total points
ID: 18867899
OOPS!

Try this

<html>
<head>
<style type="text/css">
* {padding:0;margin:0;}
html, body, img {height:100%;width:100%;}
</style>
</head>
<body>
<img src="images/beach-pictures.jpg" />
</body>
</html>
0
 
LVL 5

Author Comment

by:trifecta2k
ID: 18867906
Thanks.  It works great!
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Introduction The Google Maps API offers various ways to draw dynamic and static maps.  Using a combination of PHP and JavaScript, you can draw active JavaScript maps that allow pan-and-zoom in the client browser window.  You can also draw "static" …
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…

813 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

8 Experts available now in Live!

Get 1:1 Help Now