Solved

Picture resizing with browser

Posted on 2007-04-06
4
135 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
project copy paste issue 1 61
Show Ruler in Outlook 2010 STILL NOT SHOWING! 4 38
Copying table data to one another 15 36
Wordpress Hacked 1 70
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
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)
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

679 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