Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

one image replaces another on mobile site

Posted on 2013-12-05
7
Medium Priority
?
246 Views
Last Modified: 2013-12-06
Client has a photo of 3 awards on home page.  He wants that image to also display on mobile site.  Problem is, that image is so wide, that it doesn't downsize nicely for mobile site.  Right now, I have the image set to display:none on the mobile css.  Is there a way to actually have it display but simply display much smaller?

http://nsitedesigns.com/nsitedesigns/wrb/index.html
http://nsitedesigns.com/nsitedesigns/wrb/css/screen_layout_small.css
http://screencast.com/t/YoZB2oq5X
0
Comment
Question by:nsitedesigns
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 2000 total points
ID: 39698813
Two options.  You can use CSS to set the width in pixels.  Do not specify a height and the browser will calculate the value need to retain the aspect ration.  You cannot use percentage; it must be in pixel to work correctly.

The other option is to set it as the background of an element which will allow percentage dimensions; but that can cause distortion.

Cd&
0
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 39698814
You could create a second, smaller version of the image, and load that one for mobile browsers.
0
 

Author Comment

by:nsitedesigns
ID: 39698950
Cobol,

I modified small css file to .img_award {width:150px;}
I put this class on award image.  I cannot see the image.

Paulmaccd
If I create a second image, what width would you suggest?
How do I modify css to replace current image with new image when on mobile device?
0
Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 39699025
You have an obsolete width attribute specified directly on the image tag. that negates the CSS and makes it impossible for any kind of responsive behavior.

Cd&
0
 

Author Comment

by:nsitedesigns
ID: 39699103
I just now created img.award.  Where is there an obsolete tag?
0
 
LVL 53

Assisted Solution

by:COBOLdinosaur
COBOLdinosaur earned 2000 total points
ID: 39699259
The img tag in the markup has width specified:

<p><img src="img/awards.jpg" alt="" width="400" class="img_award" /></p>

Cd&
0
 

Author Comment

by:nsitedesigns
ID: 39699310
Ah, OK.  I removed that and now image displays pretty good on mobile portrait but still too big for landscape.  : (
0

Featured Post

Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

636 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