If you want to have a fancybox gallery within a valid HTML
document (just because we are all purists 😉 then you need two things:
1: An HTML5 DOCTYPE
<!DOCTYPE html>
2: use the data-fancybox-group
attribute rather than the rel
attribute like:
<a class="fancybox" data-fancybox-group="group1" href="https://stackoverflow.com/questions/9037061/img/work/1.jpg"></a>
That validates!! … see sample here
NOTE: this is for fancybox v2.x