<a href="[[+tv.galimage]]" class="fancybox galitem" title="[[+pagetitle]]">
<div class="galimage" style="background-image: url('[[+tv.galimage]]')"></div>
</a><div class="galimage" style="background-image: url('images/Gallery/ferrari1.jpg')"></div>
<a href="images/Gallery/ferrari1.jpg" class="fancybox galitem" title="Image 2">
</a>
[[!getResources? &parents=`122` &tpl=`galtpl` &includeContent=`1` &sortby=`{"menuindex":"ASC"}` &includeTVs=`1` &limit=`99`]]This question has been answered by claytonk. See the first response.
Block elements inside an anchor tag are an HTML5 thing, if you're using an older doctype I suppose it might be possible the browser you're viewing the source with is having trouble parsing your output.