Wrox Programmer Forums
|
CSS Cascading Style Sheets All issues relating to Cascading Style Sheets (CSS).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the CSS Cascading Style Sheets section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 16th, 2006, 04:52 PM
Banned
 
Join Date: Jul 2005
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default CSS2 Print Question

Is there a way with CSS2 Print to specify a line break after a certain amount of rows in a data table on a regular web page? Thanks for any help.

KWilliams
 
Old May 17th, 2006, 10:42 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

When you say you want a line break, are you wanting a page break?

Otherwise, it's difficult to dynamically control print without help from other sources (such as javascript, or server-side script).

You could, for instance, include a classname after so many rows, and from the print style sheet increase the space there.

Code:
<style type='text/css' media='print'>
     tr.row td {
         padding-bottom: 100px;
     }
</style>
And then have some html like this...

Code:
<tr>
    <td>This is a row</td>
</tr>
<tr>
    <td>This is a row</td>
</tr>
<tr>
    <td>This is a row</td>
</tr>
<tr>
    <td>This is a row</td>
</tr>
<tr>
    <td>This is a row</td>
</tr>
<tr>
    <td>This is a row</td>
</tr>
<tr>
    <td>This is a row</td>
</tr>
<tr>
    <td>This is a row</td>
</tr>
<tr>
    <td>This is a row</td>
</tr>
<tr class='row'>
    <td>This is a row</td>
</tr>
There are two properties that can be used to force a page break, but you'd have to use these with the knowledge that it is futile to try to control the client's print enviornment, unless you have control over it. The client could have different sizes of paper, print in a different orientation, or otherwise influence the variables.

Those properties are page-break-before and page-break-after

http://www.w3.org/TR/2006/WD-CSS21-20060411/page.html

http://msdn.microsoft.com/workshop/a...reakbefore.asp
http://msdn.microsoft.com/workshop/a...breakafter.asp

Those properties are just about the only ones universally supported, and at that with only the "always" or "auto" values.

HTH!

Regards,
Rich

--
Author,
Beginning CSS: Cascading Style Sheets For Web Design
CSS Instant Results

http://www.catb.org/~esr/faqs/smart-questions.html





Similar Threads
Thread Thread Starter Forum Replies Last Post
Textbox problem print preview vs. print jenisageek Access 5 May 2nd, 2008 12:54 PM
CSS2: Horizontal Rule Has 1px Border in IE??? kwilliams CSS Cascading Style Sheets 4 April 27th, 2006 09:53 AM
CSS2 :hover Problem in IE6 kwilliams CSS Cascading Style Sheets 9 April 13th, 2006 02:43 PM
print the hidden page without the print dialog box kayzem Classic ASP Basics 0 April 21st, 2005 11:31 PM
Print and print preview file on the website withou appleLover General .NET 0 February 19th, 2005 02:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.