?
Solved

page-break-inside, why not working?

Posted on 2003-03-09
9
Medium Priority
?
2,038 Views
Last Modified: 2007-12-19
I have a table where I don't want the contents of a cell to break across pages. I tried the following code but still the cells break:

<table>
  <tr>
    <td style="page-break-inside:avoid">
      Some text...
    </td>
  </tr>  <tr>
    <td style="page-break-inside:avoid">
      Some text...
    </td>
  </tr>
</table>


Should this work in IE6? Is there an alternative (except those where I need to count the pixels for each line of text, etc.)
0
Comment
Question by:elvin226
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 14

Expert Comment

by:avner
ID: 8100933
Use this approach :
<td norwap="true">


Page-break-inside, as far as the MSDN documenation, is not yet supported.
0
 
LVL 5

Expert Comment

by:gator4life
ID: 8101254
The nowrap attribute is not meant to format content for printed media; it is only meant to format content on the screen.

Even though the page-break-inside attribute is not yet supported in Internet Explorer, the page-break-before and the page-break-after attributes are.  The only value for this attribute that will currently force the page break for these two attributes is the 'always' value.

So, for your example, you can do this:

<table>
    <tr>
        <td style="page-break-before: always;">
            Some text...
        </td>
    </tr>
    <tr>
        <td style="page-break-before: always;">
            Some text...
        </td>
    </tr>
</table>

which will always force a page break before both of the cells, or you can do this:

<table>
    <tr>
        <td style="page-break-after: always;">
            Some text...
        </td>
    </tr>
    <tr>
        <td style="page-break-after: always;">
            Some text...
        </td>
    </tr>
</table>

which will always force a page break after both of the cells.

gator4life
(chomp, chomp)
0
 
LVL 14

Expert Comment

by:avner
ID: 8102088
I don't think elvin226 refers to any printing issue...
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:gator4life
ID: 8102624
The only reason that the page-break-inside, page-break-before, or page-break-after CSS attributes would be used is for the layout of web content for printed media, so I would assume that this has to do with content for printed media.  Also, they state "...I don't want the contents of a cell to break across pages."  Last time I checked, web content did not inherently have pages, but printed media sure does...

gator4life
(chomp, chomp)
0
 
LVL 14

Expert Comment

by:avner
ID: 8102640
You got a point there.. I missed that part..
0
 
LVL 5

Expert Comment

by:gator4life
ID: 8102745
Then again, if they never write back, we'll never know! :-)

gator4life
(chomp, chomp)
0
 

Author Comment

by:elvin226
ID: 8108987
gator4life is correct. i asked this question because of printing issue. but i have no intention to use the page-break-before/after because it will use a lot of paper while in reality, several cells may fit 1 page. what i don't want to happen are cells breaking across pages.
0
 
LVL 14

Accepted Solution

by:
avner earned 190 total points
ID: 8108997
Then, As I wrote , since page-break-inside is not yet supported you can not solve this problem using HTML and CSS.
If the ouput of the printing is very important, Go with PDF, any other solution is not 100% realiable.
0
 
LVL 5

Expert Comment

by:gator4life
ID: 8109197
avner is correct elvin.  If you can't use what the browsers currently support through the CSS properties available, then your best bet is to convert the content into a downloadable and/or printable format, such as a .pdf, that you can link to on your website.  If you haven't noticed, this is the current status quo on much of the internet, since the CSS @media rules for printing are still too young to provide a lot of benefit.

gator4life
(chomp, chomp)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Unordered lists (HTML ul tags) are very handy to create menus of all types, shapes and sizes.  All it takes is a little knowledge of CSS and the possibilities are endless. First off, you should know the general format for menus created using the …
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
In this Micro Tutorial users will learn how to embed custom fonts into websites using @font-face in CSS Select a font: Ensure the EULA allows you to use @font-face: Download the font: Get the browser-compatible files you need: Edit your CSS       - Name …
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
Suggested Courses
Course of the Month11 days, 13 hours left to enroll

752 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