0

I have a questioner and I don't know why when printing it's creating a break before the first question.

Live demo (link)

enter image description here

davidcondrey
  • 34,416
  • 17
  • 114
  • 136
Milo
  • 58
  • 8
  • Prints what you displayed in your question along with the first two questions for me. Perhaps a local issue with your printer settings..? – davidcondrey Sep 02 '14 at 07:12
  • I think it's a problem with Firefox. I've tried right now to print it with Chrome and there is no problem whatsoever. It can be resolved in Firefox though? – Milo Sep 02 '14 at 07:15
  • When I tried, I did so in Chrome as well. – davidcondrey Sep 02 '14 at 07:21
  • possible duplicate of [Printing fieldsets in firefox](http://stackoverflow.com/questions/7336586/printing-fieldsets-in-firefox) – davidcondrey Sep 02 '14 at 08:22

1 Answers1

2

I was able to resolve the issue by removing the fieldset container that you had everything wrapped in.. Having the fieldset element was causing all of the fields to get grouped together, and since they would not all fit on the first page, they were all being pushed to the second page. By removing the fieldset element, I was able to get Firefox to print the first two questions on page 1 identically to Chrome.

It seems this is not a new problem with Firefox and fieldset not playing nice together as I found an old Bugzilla ticket from 2008 which has persisted and is still being commented on in 2014 (link)

If retaining the fieldset is important, I found a solution someone else came up with here (link)

<script type='text/javascript'>
    $(window).bind('beforeprint', function(){
        $('fieldset').each(
            function(item)
            {
                $(this).replaceWith($('<div class="fieldset">' + this.innerHTML + '</div>'));
            }
        )
    });
    $(window).bind('afterprint', function(){
        $('.fieldset').each(
            function(item)
            {
                $(this).replaceWith($('<fieldset>' + this.innerHTML + '</fieldset>'));
            }
        )
    });
</script>
Community
  • 1
  • 1
davidcondrey
  • 34,416
  • 17
  • 114
  • 136
  • I've added ``. Now on Chrome is exactly what I wanted, but in Firefox is printing me just the first page(h4 + description) and 1 page of questions. – Milo Sep 02 '14 at 08:03
  • The content is not static. It will change if the creator of the survey will make, let's say, at the first question 10 bullets. – Milo Sep 02 '14 at 08:12
  • 1
    Deleting the fieldset resolved my problem. Thank you! – Milo Sep 02 '14 at 08:33