set CORRECT width for <img/>

This is a discussion on "set CORRECT width for <img/>" within the Web Page Design section. This forum, and the thread "set CORRECT width for <img/> are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jul 26th, 2006, 12:24
New Member
Join Date: Jul 2006
Location: nl
Age: 27
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
set CORRECT width for <img/>

Hi,

I am trying to set the width of an image correct and i dont seem to find out how...

Here is the problem:

I have a floating <div><div/> thingy on my site, and in here is an image.
The image is sometimes bigger than the div-thing and the image will then just come outside of the div-box.
By setting <img style="width=100%"> the image stays inside the div-box.

So far so good!

BUT, if the image is smaller (not as width as the div box), than the image it enlarged.

How to prevent the image becomming bigger then it's actual size??

Thanks in advance
Reply With Quote

  #2 (permalink)  
Old Jul 26th, 2006, 12:35
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,765
Blog Entries: 1
Thanks: 0
Thanked 18 Times in 18 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: set CORRECT width for <img/>

#foo {
width:;
height:;
overflow:hidden;
}
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Reply With Quote
  #3 (permalink)  
Old Jul 26th, 2006, 13:02
New Member
Join Date: Jul 2006
Location: nl
Age: 27
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Re: set CORRECT width for <img/>

Whaw, that was quick

I have tryed (something) like that but it didnt work

i show some example (the link below);

If the window is too small to display the picture in its original size the picture will be resize smaller. (This is what i want )

And if you run this in a REALLY big window the picture will be enlarged.
(That is NOT what i want, Instead I would like that the picture was shows in its original size)

http://iersel.ie.funpic.org/bookmark.php?id=54

Last edited by iersel; Jul 26th, 2006 at 13:08.
Reply With Quote
  #4 (permalink)  
Old Jul 26th, 2006, 13:22
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,765
Blog Entries: 1
Thanks: 0
Thanked 18 Times in 18 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: set CORRECT width for <img/>

Well, are you looking to do a thumbnail gallery or just have it fit to the image at any size?
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Reply With Quote
  #5 (permalink)  
Old Jul 26th, 2006, 13:23
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,765
Blog Entries: 1
Thanks: 0
Thanked 18 Times in 18 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: set CORRECT width for <img/>

I have a very basic thumbnail gallery at http://www.newguyinennis.com/photography if that is somewhat what you are trying to accomplish. Alternately you could use javascript or similar to detect the image dimensions and write the div with the appropriate width and height but I am not sure that is the best solution to the problem.
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Reply With Quote
  #6 (permalink)  
Old Jul 26th, 2006, 13:36
New Member
Join Date: Jul 2006
Location: nl
Age: 27
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Re: set CORRECT width for <img/>

I am not sure if i understand your question correct.

If i run this page (http://iersel.ie.funpic.org/bookmark.php?id=54) in a fullscreen brower window (screen resolution 1600*1200) the image is bigger than its actual size.
I would prefer to show the picture in its original size.

If i run the same page in a really small window the picture will be displayed smaller than its actual size. That is what i want and is working correct now.


So the question is how to have both cases working correctly at the same time?
1.) display the picture in a big window with its original dimensions (not working)
2.) display the same image in a small window with a correctly resized image (working)

I have somehow to set the image max-width to its own width but i dont find a solution for it

Thanks you for further assitence.

(By the way, i am going out right now but ill be back tommorrow)
Reply With Quote
  #7 (permalink)  
Old Jul 26th, 2006, 14:33
Highly Reputable Member
Join Date: Aug 2005
Location: 3rd Branch Up, Old Oak.
Age: 48
Posts: 658
Thanks: 0
Thanked 0 Times in 0 Posts
Re: set CORRECT width for <img/>

Are you using px or % to display it?
If you use % it will resize accordingly.
Reply With Quote
  #8 (permalink)  
Old Jul 26th, 2006, 17:36
Reputable Member
Join Date: Jul 2005
Posts: 400
Thanks: 0
Thanked 0 Times in 0 Posts
Re: set CORRECT width for <img/>

I see what you want, but this won't work without some kind of programming because you can't have both scenarios. If it can get smaller then it's allowed to get larger, just the nature of the beast.
Reply With Quote
  #9 (permalink)  
Old Jul 27th, 2006, 07:33
New Member
Join Date: Jul 2006
Location: nl
Age: 27
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Re: set CORRECT width for <img/>

found an (almost) solution http://www.doxdesk.com/software/js/minmax.html

thanks!!
Reply With Quote
Reply

Tags
set, correct, width, ltimggt

Thread Tools

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pictures disappearing with correct width and height! ChrisTheSoul Web Page Design 3 Sep 3rd, 2007 21:56
RAH (correct links) Digger Free Web Site Critique 9 Aug 29th, 2007 20:05
Why isnt my website correct in IE? artistxecrpting Web Page Design 3 Jun 8th, 2007 12:26
XML/RDF Example, is it correct? Wheeler Other Programming Languages 0 Oct 19th, 2005 17:48


All times are GMT. The time now is 03:11.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43