Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 06-12-2012, 12:44 AM   #1
AdultKing
Raise Your Weapon
 
AdultKing's Avatar
 
Industry Role:
Join Date: Jun 2003
Location: Outback Australia
Posts: 15,605
CSS Image resize question

I am resizing an image using CSS so that always fits within the browser window displaying the image.

The CSS I am using is

Code:
div#sized {	text-align: center; }
div#sized img{	height: 90%; border: none; padding:15px; top: 10%; position: relative }
the HTML is

Code:
<div id="sized"><a href="http://example.com"<img src="someimage.jpg" alt="image text" /></a></div>
It works fine in Safari and Firefox, however will not work on the iPad or iPhone. On those devices it just shows the full sized image not constrained within the DIV.

Does anyone have any idea on a better way to do this within the constraints of plain CSS and HTML ?

Last edited by AdultKing; 06-12-2012 at 12:45 AM..
AdultKing is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-12-2012, 12:55 AM   #2
Nevet
Registered User
 
Industry Role:
Join Date: Dec 2011
Posts: 10
You can use max-width to prevent the image from bleeding over the edge of the display area.

Code:
#sized img { max-width: 100%; }
Nevet is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-12-2012, 06:28 AM   #3
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,248
Quote:
Originally Posted by AdultKing View Post
I am resizing an image using CSS so that always fits within the browser window displaying the image.

The CSS I am using is

Code:
div#sized {	text-align: center; }
div#sized img{	height: 90%; border: none; padding:15px; top: 10%; position: relative }
the HTML is

Code:
<div id="sized"><a href="http://example.com"<img src="someimage.jpg" alt="image text" /></a></div>
It works fine in Safari and Firefox, however will not work on the iPad or iPhone. On those devices it just shows the full sized image not constrained within the DIV.

Does anyone have any idea on a better way to do this within the constraints of plain CSS and HTML ?
if its wordpress

http://viewportindustries.com/blog/a...-in-wordpress/
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-12-2012, 06:52 AM   #4
acctman
Confirmed User
 
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
photo / image auto resizing is simple...

.photo img { width: 100% }
.photo { width: 40% } // print can be any size you want the default to be and can be applied to a div as a class.
acctman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-12-2012, 07:21 AM   #5
AdultKing
Raise Your Weapon
 
AdultKing's Avatar
 
Industry Role:
Join Date: Jun 2003
Location: Outback Australia
Posts: 15,605
Thanks for all the replies. I've got it sorted now.
AdultKing is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.