I have an image that I needed to declare as block-level element in order to center it with CSS (Why can CSS not have a simple "center"?):
img {
display: block;
margin: 0 auto;
}
The problem is that the image also needs to be linked. Problem because you are not supposed to wrap <a> which is an inline element around block level elements.
All
solutions [webmasterworld.com] I
found [codingforums.com] to this problem suggest to switch the anchor tag and the block-level tag, e.g.:
<h1><a>...</a></h1>
Unfortunately, this doesn't work with images. What to do?