Solved

Picture resizing with browser

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Do you want to insert HTML5 video into your site? This is the tutorial how to do so. What are the main advantages of HTML5 video? 1) Have good compression, good image quality, and low decode processor use. 2) It is royalty-free 3) It is easi…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
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 code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

707 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

13 Experts available now in Live!

Get 1:1 Help Now