Melody Scott
asked on
Bootstrap img-responsive question
If I have an image inside a link, like:
<a href="/menu/main_courses.h tml"><img src="/images/linkshare/201 5/DC-15.jp g" alt="promo" width="720" height="554"/></a>,
Where do I put the class="img-responsive"? In the a tag or the img tag?
<a href="/menu/main_courses.h
Where do I put the class="img-responsive"? In the a tag or the img tag?
<img src= class = alt=/>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks!
ASKER
OK, I have done that here: http://dev2.magickitchen.com/landing/linkshare/2015/SP-FD.html
No width or height, and img-responsive class on the image. But all the mobile emulators I have looked at show the image as not being responsive.
No width or height, and img-responsive class on the image. But all the mobile emulators I have looked at show the image as not being responsive.
<div style="width:100%;">
<div style="width:720px; margin-left:auto; margin-right:auto;"><a href="http://www.magickitchen.com/menu/main_courses.html"><img src="/images/linkshare/2015/SP-FD.jpg" alt="promo" class="img-responsive" border="0"></a></div></div>
You fixed a div width 720px.so its not seem tobe responsive
You remove that style and check
I checked the link and Nrupendra is correct.
The img-responsive class assigns a width=100% to the image, so in your page since your div is 720 px the images also has a width of 720px.
in higher resolutions the image will be shown in its ACTUAL width in pixels.
The img-responsive class assigns a width=100% to the image, so in your page since your div is 720 px the images also has a width of 720px.
in higher resolutions the image will be shown in its ACTUAL width in pixels.
ASKER
Argh, Of course. Thanks for pointing that out.
ASKER
But now the photo is not centered.
http://dev2.magickitchen.com/landing/linkshare/2015/AG-11.html
I have tried using text-align:center on this and it doesn't always work:
http://dev2.magickitchen.com/landing/linkshare/2015/CODE15.html
I've also tried: class="img-responsive center-block"
http://dev2.magickitchen.com/landing/linkshare/2015/AG-FD.html
http://dev2.magickitchen.com/landing/linkshare/2015/AG-11.html
I have tried using text-align:center on this and it doesn't always work:
http://dev2.magickitchen.com/landing/linkshare/2015/CODE15.html
I've also tried: class="img-responsive center-block"
http://dev2.magickitchen.com/landing/linkshare/2015/AG-FD.html
ASKER
Never mind, I figured that out, it was the width again. OK, I think I have it hammered into my head now, thanks!!