How To Center An Image Using HTML5 Valid Syntax

9:47 AM

If You Want To Center An Image In HTML File. Use Any Method From The Following Methods To Center An Image, I Prefer To Use HTML5 Valid Synta...

HTML5
If You Want To Center An Image In HTML File. Use Any Method From The Following Methods To Center An Image, I Prefer To Use HTML5 Valid Syntax (Second Method). For This You Need To Add CSS Attributes To IMG Tag. You Can Also Add Border To Image And Many Other Effects Using CSS With HTML.

Two Methods To Center An Image In WebPage.

1. Using Center Tag, This Is Not HTML5 Valid Syntax. But This Code Center An Image.
<center><img src="ImageURL" alt="Alt Text" title="Image Title" width="128" height="128"/></center>
2. By Adding CSS Attribues Auto Margin And Block Display (Image Is An Inline Element Change It To Block Element). This Is HTML5 Valid Syntax
<img style="margin:0px auto;display:block"src="ImageURL" alt="Alt Text" title="Image Title" width="128" height="128"/>
Share Your Views With Comments Thanks

No comments: