Title: Split text when printing pages
Last modified: January 19, 2021

---

# Split text when printing pages

 *  [apgsmriti](https://wordpress.org/support/users/apgsmriti/)
 * (@apgsmriti)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/split-text-when-printing-pages/)
 * Hello! I’m trying to set up print-optimized versions of my webpages. I’m using
   WordPress and Elementor. I’ve run into a very fundamental problem: Lines of text
   and images are splitting between the bottom of one page and the top of the next.
   After several hours of searching, I discovered a “styling for print” page with
   css coding instructions ([https://codex.wordpress.org/Styling_for_Print](https://codex.wordpress.org/Styling_for_Print)).
   I tried versions of this code:
    [@media](https://wordpress.org/support/users/media/)
   print { img { page-break-inside:avoid; } text { page-break-inside:avoid; } } 
   This _did_ fix the problem for images, but not for the text. This is a very basic
   design flaw in WordPress (or Elementor, which I suppose could be overriding the
   settings.) I have also tried to find a plugin, and so far have found none that
   work. This seems like it should have a simple fix. Thanks for your assistance!

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [fullworks](https://wordpress.org/support/users/fullworks/)
 * (@fullworks)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/split-text-when-printing-pages/#post-13929140)
 * Sorry that you are struggling with this.
 *     ```
       @media print {
       img { page-break-inside:avoid; }
       text { page-break-inside:avoid; }
       }
       ```
   
 * Is CSS so it is not specific to WordPress or Elementor but the way websites work
   in general with HTML.
 * The issue you have is `text` is not an HTML element so will not be recognized.
 * You need to use valid HTML e.g. `p` for paragraph
 *     ```
       @media print {
       img { page-break-inside:avoid; }
       p { page-break-inside:avoid; }
       }
       ```
   
 * see [https://codex.wordpress.org/Styling_for_Print#Page_Breaks](https://codex.wordpress.org/Styling_for_Print#Page_Breaks)
   for more examples
    -  This reply was modified 5 years, 4 months ago by [fullworks](https://wordpress.org/support/users/fullworks/).
    -  This reply was modified 5 years, 4 months ago by [fullworks](https://wordpress.org/support/users/fullworks/).
    -  This reply was modified 5 years, 4 months ago by [fullworks](https://wordpress.org/support/users/fullworks/).
 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/split-text-when-printing-pages/#post-13929163)
 * This is not a design flaw in WordPress, since WordPress isn’t responsible for
   the output on the front end. The theme is responsible for that, and it should
   have print styles. But a lot of themes do not bother.
    The last several default
   themes have print styles, because I advocated for them, although they might not
   all handle everything. You can read the print stylesheets for those Twenty* themes
   to see what is in them, and add it to your Custom CSS.
 *  Thread Starter [apgsmriti](https://wordpress.org/support/users/apgsmriti/)
 * (@apgsmriti)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/split-text-when-printing-pages/#post-13929425)
 * Thanks for these suggestions. I tried the code “p { page-break-inside:avoid; }”
   but unfortunately it didn’t work. I also tried “pre” for good measure. I’m looking
   into the second comment right now.
 *  [fullworks](https://wordpress.org/support/users/fullworks/)
 * (@fullworks)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/split-text-when-printing-pages/#post-13929466)
 * You need to examine the html that is being split and then use the right selector.
 *  Thread Starter [apgsmriti](https://wordpress.org/support/users/apgsmriti/)
 * (@apgsmriti)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/split-text-when-printing-pages/#post-13929629)
 * Thanks. The html class of the text is either p, div, or span. I’ve tried all 
   of these, one by one and together, and unfortunately none of them work. Sometimes
   these put large gaps into the printed pages, but they are still splitting individual
   lines of text.
 * I found the print stylesheet for the newest WordPress theme, and it uses the 
   same method. I also tried setting the page margins within the print css, but 
   that also didn’t work.
 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/split-text-when-printing-pages/#post-13929783)
 * Those print styles don’t dictate no breaks, only that the breaks should be avoided
   if possible. Obviously, you can’t avoid a break of something that is longer than
   a page. And to try to put that on span tags is kinda crazy. It is usually for
   block elements such as tables and images.
 *  Thread Starter [apgsmriti](https://wordpress.org/support/users/apgsmriti/)
 * (@apgsmriti)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/split-text-when-printing-pages/#post-13929869)
 * Perhaps the problem is on Elementor’s side, so I’ll see what I can find out through
   them. Honestly, this is a ridiculous problem. There is a design flaw somewhere.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Split text when printing pages’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 3 participants
 * Last reply from: [apgsmriti](https://wordpress.org/support/users/apgsmriti/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/split-text-when-printing-pages/#post-13929869)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
