Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Resizing an image according to the screen width
Old 07-12-2010, 03:12 PM Resizing an image according to the screen width
Thort's Avatar
Average Talker

Latest Blog Post:
Popular Foxglove
Posts: 19
Location: Sweden
Trades: 0
Hi!

How do I achieve this:

I have an image 1000 pixels wide. If the image doesn't fit on the screen I want the width to be resized bit by bit down to a minimum of 700 pixels.
__________________
Thor


Please login or register to view this content. Registration is FREE
Thort is offline
Reply With Quote
View Public Profile Visit Thort's homepage!
 
 
Register now for full access!
Old 07-12-2010, 03:19 PM Re: Resizing an image according to the screen width
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,376
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
You could set the width of the image element with javascript but that would simply squash the image NOT resize it.

Or you could try this
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-12-2010, 06:09 PM Re: Resizing an image according to the screen width
Thort's Avatar
Average Talker

Latest Blog Post:
Popular Foxglove
Posts: 19
Location: Sweden
Trades: 0
Thanks chrishirst!

I followed your link and looked into the example. The site suggests the following css class:

.resize {
width: 200px;
height : auto;
}

.resize {
width: auto;
height : 300px;
}


I don't understand how this works.

I want my 1000 pixel image to vary between 700 and 1000 pixels in width when resizing the window.

I want to show my 1000 pixel image on my blog. When people watch the blog with a 1024x768 pixel resoulution I want the browser to resize the image to 700 pixel width. When watching with higher resolution I want the image turn up with its original width, 1000 pixels.
__________________
Thor


Please login or register to view this content. Registration is FREE
Thort is offline
Reply With Quote
View Public Profile Visit Thort's homepage!
 
Old 07-12-2010, 06:34 PM Re: Resizing an image according to the screen width
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,376
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
1/ What about users with higher resolution but do NOT have their browser full screen?

2/ What about users such as myself who have two screens at different resolutions?

3/ There is no reliable cross-bowser method to detect when a browser window is resized.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-13-2010, 02:12 AM Re: Resizing an image according to the screen width
Thort's Avatar
Average Talker

Latest Blog Post:
Popular Foxglove
Posts: 19
Location: Sweden
Trades: 0
Quote:
Originally Posted by chrishirst View Post
1/ What about users with higher resolution but do NOT have their browser full screen?
If my 1000 pixel image fits the screen, let it show up 1000 pixels wide.

If the 1000 pixel image doesn't fit in on the screen let it be resized in order to fit.
__________________
Thor


Please login or register to view this content. Registration is FREE
Thort is offline
Reply With Quote
View Public Profile Visit Thort's homepage!
 
Old 07-16-2010, 01:08 AM Re: Resizing an image according to the screen width
shivaji's Avatar
Ultra Talker

Posts: 321
Trades: 0
I am not sure am I understand your question right. Did you want resize image on fixed dimension and vary only between 700 and 1000px or you want to resize image on any screen width. If you want first solution try this (I didn't define height):

Code:
#header{
	max-width: 1000px;
	min-width: 700px;
}

#header img{
	width: 100%;
}
NOTE: this is not work in IE6
__________________

Please login or register to view this content. Registration is FREE
- uncommon free scripts

Please login or register to view this content. Registration is FREE
- Städte, Sport, Party, Gourment, Apartments, Hotels

Last edited by shivaji; 07-16-2010 at 01:12 AM..
shivaji is offline
Reply With Quote
View Public Profile Visit shivaji's homepage!
 
Old 07-21-2010, 01:24 PM Re: Resizing an image according to the screen width
Thort's Avatar
Average Talker

Latest Blog Post:
Popular Foxglove
Posts: 19
Location: Sweden
Trades: 0
Thanks shivaji!

This was exactly what I wanted!

I inserted my picture into a div-tag which a styled like this:

<div style="min-width:700px; max-width:1000px; width:100%">

You can see the result here on my blog.

People with 1024x768 resolution will see the picture 700 pixels wide. People with higher resolution will see it 1000 pixels wide.
__________________
Thor


Please login or register to view this content. Registration is FREE
Thort is offline
Reply With Quote
View Public Profile Visit Thort's homepage!
 
Old 07-22-2010, 07:01 AM Re: Resizing an image according to the screen width
shivaji's Avatar
Ultra Talker

Posts: 321
Trades: 0
Great if this solution help you. BTW very nice blog and photos.
__________________

Please login or register to view this content. Registration is FREE
- uncommon free scripts

Please login or register to view this content. Registration is FREE
- Städte, Sport, Party, Gourment, Apartments, Hotels
shivaji is offline
Reply With Quote
View Public Profile Visit shivaji's homepage!
 
Reply     « Reply to Resizing an image according to the screen width
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.89842 seconds with 12 queries