HTML5 | How to Centre An Image

Centre An Image in HTML5

Centering an image in the past was done with arduous workarounds in CSS and JQuery – not any more. The best way to centre an image is by using either one of the below lines – no CSS, no JQuery. If you want to put the style inside a CSS file you can but the below works great on

  • Internet Explorer 7+
  • Chrome (including Android Tablets)
  • Mozilla Firefox (Windows and Linux)
  • Safari on iPad and iPhone
  • Samsung Galaxy, BlackBerry …

If you like it just right click the mouse, view source, then copy the HTML you need.

Method 1 – Centre Image (Simple)

Image description that will show when you hover over it with the mouse.

Method 2 – Encapsulating DIV block around Image

Image description that will show when you hover over it with the mouse.

Leave a Reply

Your email address will not be published. Required fields are marked *