🔔 Alert..!! Get 2 Month Free Cloud Hosting With $200 Bonus From Digital Ocean ACTIVATE DEAL

A very small jQuery plugin that automatically resizes, crops, stretches and re-positions your images to make them always be centered within the container.

responsive-image

Documentation

Center image inside any tag (inline or block)

  • First off all, I would like to say that anyone can use this code for free.
  • Clone the ripo OR download and extract it.

How to use??

  • Put an img tag inside any block(div) or inline(span) tag.
<div>   <img src="https://www.xyz.com/my-image.jpg" alt="my image" /> </div>

A quick note: The image inside the the tag will contain the whole tag.

  • Give it class asdh-center_image_inside_me
<div class="asdh-center_image_inside_me">   <img src="https://www.xyz.com/my-image.jpg" alt="my image" /> </div>
  • Done. It's that simple.

Default dimentions

  • By default, width and height are assigned to be 200px each, which can be modified as per your need. I have even included an example in the code itself.

You May Also Like