Solved

Picture resizing with browser

Posted on 2007-04-06
4
137 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
[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
  • 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Find out what you should include to make the best professional email signature for your organization.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

734 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