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
CSS to scale down image size
Old 01-30-2011, 07:31 PM CSS to scale down image size
Skilled Talker

Posts: 57
Name: karim
Trades: 0
I'd like to know if there is a way to scale down images to a set size in px, but WITH maintaining aspect ratio because not all images are square. Say to make the image fit a frame of 180px by 180px.

Also it should be compatible with all browsers.

I know that

img {
width: 50%;
height: 50%;
}
Can give a workable solution. However I need a foolproof one in case the image sizes are significant;y different, or if the images are the correct width as they are and this css just reduces it to half for no reason.
__________________

Please login or register to view this content. Registration is FREE
for businesses and dealers
Please login or register to view this content. Registration is FREE
TurboLizard is offline
Reply With Quote
View Public Profile Visit TurboLizard's homepage!
 
 
Register now for full access!
Old 01-30-2011, 10:21 PM Re: CSS to scale down image size
Digital Friend's Avatar
...

Posts: 2,016
Name: Marc
Location: The Caribbean
Trades: 0
If you are planning to have different images re-sized, why not use HTML height/width attributes :

HTML Code:
<img src="IMAGE" height="50px" width="50px" />
It's perfect for re-sizing a lot of images on your web page with different sizes,
__________________
Blackberry Torch - Make it your next smartphone, or we'll find you. <_<
Digital Friend is offline
Reply With Quote
View Public Profile
 
Old 01-31-2011, 12:48 AM Re: CSS to scale down image size
Skilled Talker

Posts: 57
Name: karim
Trades: 0
it's a database driven site.. images vary in size from 150px to 300px in width, also shape as well.

The images need to be tiled in a 3x3 format, so I'm looking for a way to make the images uniform to look good on the site.

do the css needs to be like a catch all system that will resize all the images at the user end, hoping there is a css fix out there, because I don't want to spend a fortune getting a programmer to fix the php system to make the images a certain size to begin with.
__________________

Please login or register to view this content. Registration is FREE
for businesses and dealers
Please login or register to view this content. Registration is FREE

Last edited by TurboLizard; 01-31-2011 at 12:49 AM..
TurboLizard is offline
Reply With Quote
View Public Profile Visit TurboLizard's homepage!
 
Old 01-31-2011, 07:43 AM Re: CSS to scale down image size
Skilled Talker

Posts: 60
Name: Dmitry
Trades: 0
You can try css parameter max-width in percent value.
Something like this:
<img class="imglow" src="/images/image.jpg" />
.imglow {max-width:30%;}
__________________
Sincerely, Dmitry

Please login or register to view this content. Registration is FREE
ElmanF is offline
Reply With Quote
View Public Profile Visit ElmanF's homepage!
 
Old 02-01-2011, 05:22 PM Re: CSS to scale down image size
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,376
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
http://unstoppablerobotninja.com/entry/fluid-images/
__________________
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 02-02-2011, 02:35 AM Re: CSS to scale down image size
ihasfunny's Avatar
Novice Talker

Posts: 6
Trades: 0
I already tried this solution for my blog and working fine

img {
max-width: 150px;
}

I think not need to add height, It will taken as per proportion
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
ihasfunny is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to CSS to scale down image size
 

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.40369 seconds with 12 queries