Tuesday, November 6, 2012

How To Center A Image Using [html 5] Code

For center a image in html 5 you should follow css and you can't use center html tag because it is not a valid html 5 tag. So for centering a image you can use the css code margin. Make the left and right margin as auto and top and bottom as zero.

Centering Image in html 5

Below is the code css code to make a image at center using css which is a html 5 valid method.

margin: 0px auto;display:block

If you apply the above css elements to a image it will look like the below given code

<img style="margin:0px auto;display:block" src="Image URL Here"/>
Find us on Google+
Bloggers.com