It´s fine, but I would recommend against this.
From a SEO perspective its best to have clean hyperlinks with clear descriptions.
Now you have 4 elements (3 images and 1 header) of which the images lack a description in your example.
Also with regard to your CSS you might run into undesired behavior for the end/user, since you apply a link to different elements. By that I mean that you MAY have to style differently for the example above.
If you try your code you will see it does what is expected in basically all browsers, but why make it difficult for yourself.