+ 1
How do I center an image in HTML? I have tried the align attribute but it had no effect.
6 Réponses
+ 4
* Set the parent tag "text-align" property to "center"
Notices:
<center> is deprecated in HTML5
"align" attribute is not supported in HTML5
+ 3
<img src="yourimage.jpg" alt="" align="center"/>
if you cannot get it,try below code
<p align="center"><img src="yourimge.jpg" alt=""/></p>
+ 3
<figure align="center">
<img src="imagename.jpg" width="300" height="300">
</figure>
<figure> is the HTML5 Tag which you need for an image
"width" and "height" specifies the size of the image
align="center" aligns the image in the center
hope this helps
~Kamil
+ 2
Use these:
<center>....</center>
These tags are some much easier to use :)
+ 2
Ok when i tagged the image as <p></p> it worked as well as the <center></center> tags. I haven't tried the figure tag yet because I haven't really started working with html5 yet. Thanks everybody.
+ 1
Have you tried <img ... align="middle" ... >? Watch the reference on http://www.w3schools.com/TAgs/att_img_align.asp Hope, it helps. :)