Bootstrap img-responsive question

If I have an image inside a link, like:
<a href="/menu/main_courses.html"><img src="/images/linkshare/2015/DC-15.jpg" alt="promo" width="720" height="554"/></a>,

Where do I put the  class="img-responsive"? In the a tag or the img tag?
Melody ScottAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jessica WhitleySoftware DeveloperCommented:
<img src= class = alt=/>
Nrupendra Nath PanigrahiCommented:
U put  the  class="img-responsive" in img tag
<a href="/menu/main_courses.html">
<img  class ="img-responsive " src="/images/linkshare/2015/DC-15.jpg" alt="promo" width="720" height="554"/>

Open in new window

Prasadh BaapaatWeb Designer & DeveloperCommented:
only adding the class img-responsive will not help. remove the height & width from image as well...

<a href="/menu/main_courses.html">
<img  class ="img-responsive " src="/images/linkshare/2015/DC-15.jpg" alt="promo" />

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Melody ScottAuthor Commented:
Melody ScottAuthor Commented:
OK, I have done that here:

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.
Nrupendra Nath PanigrahiCommented:
<div style="width:100%;">
  <div style="width:720px; margin-left:auto; margin-right:auto;"><a href=""><img src="/images/linkshare/2015/SP-FD.jpg" alt="promo" class="img-responsive" border="0"></a></div></div>

Open in new window

You fixed a div width its not seem tobe responsive

You remove that style and check
Prasadh BaapaatWeb Designer & DeveloperCommented:
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.
Melody ScottAuthor Commented:
Argh, Of course. Thanks for pointing that out.
Melody ScottAuthor Commented:
But now the photo is not centered.

I have tried using text-align:center on this and it doesn't always work:

I've also tried: class="img-responsive center-block"
Melody ScottAuthor Commented:
Never mind, I figured that out, it was the width again. OK, I think I have it hammered into my head now, thanks!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.