简体   繁体   中英

HTML / CSS Page break not working

I have this page with multiple records I want to print.

The problem is that I get a blank page at the end.

My CSS:

.break { 
    page-break-after: always; 
    }

My html/php:

...
</table>
  <p class="break">&nbsp;</p>
    <?php } while ($row_RSacessorios = mysql_fetch_assoc($RSacessorios)); ?>
</body>
</html>
<?php
mysql_free_result($RSacessorios);
mysql_free_result($RSfases);
?>

I found a simple solution. I just remove the class "break" on the last record.

if ($count < $total_rec) {
  <p class="break">&nbsp;</p>
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM