This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Double Page break Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Double Page break" Watch "Double Page break" New topic

Double Page break

Kin Ng

Joined: May 06, 2005
Posts: 16
I'm using this tag for generating page breaks for printing..
<!-html text -->
<br style="page-break-after:always;"></br>
<!-html text -->
most of the time it works fine...
However...something goes wrong when the text before
the break actually filled out one full page.
It causes the break to appear as the first tag in the second page,
and it generated a page break at the beginning of the page.
Thus, I'm now having an extra blank sheet in between.
page 1. some text
page 2. blank
page 3. some text

Is there anyway that i can specify the page break so that it
only generates a page break when it's not at the beginning of page??

Thanks for your help guys.....

[ October 04, 2005: Message edited by: Bear Bibeault ]
Garann Means
Ranch Hand

Joined: Jan 28, 2002
Posts: 214
You might want to look into page-break-before instead of page-break-after and/or auto instead of always. If you can't get it to work with some combination of those attributes, I'd say it's most likely a problem with the browser. You could also try this for your break:

Kin Ng

Joined: May 06, 2005
Posts: 16
Thanks for your response.

auto didn't give me any page break at all.

and "page-break-after:always;page-break-before:avoid"

produce the same result. i.e. a blank page

Garann Means
Ranch Hand

Joined: Jan 28, 2002
Posts: 214
The only other thing I can think of is to maybe add display:inline or line-height:1px or other attributes to make the break take up less space on its own. Good luck...
I agree. Here's the link:
subject: Double Page break
Similar Threads
Display Problem in html
Keyword xsl:output may not be used here.
Simple PHP problem
change CSS rules dynamic with JavaScript
HTML tags in JSF