Solved

Creating Page Breaks in an HTML Document

Posted on 1999-01-28
4
156 Views
Last Modified: 2010-04-09
Is there a way to put page breaks in an html document so that you can control how much is printed out on each page?
0
Comment
Question by:kch011099
  • 2
4 Comments
 
LVL 6

Expert Comment

by:PBall
ID: 1845773
This is like what.... the 3rd or 4th time this question pop up.
This is in the paq (now if only these people at expert exchange will implement their disfunctional search stupid thingy) ugh.

Anyway, do this:

<style>
break {
  page-break-after:always
}
</style>

:
:

This is the old page
<p class=break></p>
This is a new page.
<p class=break></p>
This is another new page.

This will work in IE4, don't count on it on Netscape unless anyone else has tried it.

Now you can remove this question...
0
 

Author Comment

by:kch011099
ID: 1845774
I need this to work in both Explorer and Netscape.
0
 
LVL 6

Expert Comment

by:PBall
ID: 1845775
Good luck :)
0
 
LVL 8

Accepted Solution

by:
jhurst earned 50 total points
ID: 1845776
As was said, this is a very commom question.  The fact is that despite what the documentation says there is no method in html that works.

However, there is a kludge that you can use and does work.

One of the browsers will always attempt to keep a table on the same page, the other will do the same with an image.  SO you place the entire text that you want on a page as a single element of a one row table, you also include a transparent gif that is as long as the page in the second column of the table.

Now when the browser attempts to keep the table on a page, or the image, you get what you want.  

We have been using this method for a year now in literally thousands of sites and it works well with NN and MSIE 3 and 4.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Find out what you should include to make the best professional email signature for your organization.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question