Issue
I am trying to center an image using only HTML and no CSS, is this possible? I have tried the following code:
<a href="link">
<img src="URL" align="center"></a>
However the image doesn't move. How can I solve this?
The image I am trying to center is the donate button on the right column of our blog I am placing the link in a "text" widget so the CSS doesn't seem to work there.
Solution
Well, you could use <center>
, but it is no longer supported. Your best bet here is to use the style attribute in HTML and text-align:center
. This won't directly center the image, so you would wrap it in a div with the styling:
<div style="text-align: center">
<a href="link">
<img src="URL" align="center"></a>
</div>
After looking at a comment that was posted, I see that you actually don't need the div. Just apply it to the link around it.
<a href="link" style="text-align: center">
<img src="URL" align="center"></a>
There is no possible way to do this without CSS, unless you want to use outdated stuff.
Answered By - StackExchange User
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.