The page-break-inside property is essential for ensuring clean and organized printouts

Ensuring my application is compatible with all modern browsers is a top priority for me. It is essential that the minimum version of Internet Explorer supported is IE9.

I recently constructed a simple print-friendly page containing a table which displays information about various articles, including unique barcodes.

The challenge arises when attempting to print this page as the final row spills onto two separate pages, causing the barcode number to split between them due to its special font style.

In an effort to resolve this issue, I explored the implementation of page-break-inside. Here is the current code snippet:

<div class="col-xs-12">
    <div class="row">
    <p class="text-center">Price List</p>
        <table class="table borderless">
            <thead>
                <tr>
                    <th class="col-xs-4">Description</th>
                    <th class="col-xs-2">Price / unit</th>
                    <th class="col-xs-2">Size</th>
                    <th class="col-xs-4">Code</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="article in vm.data.articles">
                    <div><td>{{ article.description }}</td></div>
                    <div><td>{{ article.unitPrice }}</td></div>
                    <div><td>{{ article.length }}</td></div>
                    <div><td style="font-family: barcode, arial; font-size: 225%;">{{ article.itemNumber | barcode }}</td></div>
                </tr>
            </tbody>
        </table>
    </div>
</div>

css: 

tr {
    page-break-inside: avoid;
}

(Please disregard the temporary inline styling added purely for testing)

To my disappointment, none of these solutions seem to address the printing dilemma. Despite consulting colleagues, one even suggesting the impossibility of achieving success with this scenario.

Is there truly no feasible solution to this problem? Could it be that what I am aiming for is unattainable through conventional means? If not, why does the implemented approach fail to deliver the desired outcome?

Answer №1

To uncover the solution, employ a bit of CSS wizardry.

For instance:

table tbody {
  position: fixed;
  bottom: 0;
  top: /* insert your preferred value here. */ 
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Strategies for quickly landing in top Google search results

I run a website for classified ads... Whenever users post a new ad, it gets automatically included in our dynamic sitemap (xml). Our sitemaps were submitted to Google via Webmaster Tools about two months ago. While some of the ads are indexed, it is tak ...

Exploring the Versatility of Axios

Today, I implemented an AJAX request using Axios in JavaScript to submit form data. While the requests are being sent successfully, it seems that the backend is not able to receive the username and password information from the frontend. What could be ca ...

Using CSS Grid in Combination with Absolute Positioning in Safari

Encountering an issue with a css grid layout. The grid container is positioned absolutely and the grid-template-rows includes a 1fr to allocate space for one row to take up all available space. While this renders correctly on most browsers, it fails to d ...

Guide to invoking a JavaScript function within a forEach loop

I'm currently working on customizing a plugin for including input tags, which can be found here Below is a simplified version of my problem. The plugin scans the page for any HTML elements with the 'tags-input' class and creates functions t ...

AngularJS dropdown feature: fill two input fields with distinct data for each selection option

As a beginner in AngularJS, I am trying to create a functionality where selecting an option from the dropdown menu RegistrationType will determine what appears in both the input fields RegAmount and RegistrationType. For example, if I select the first opti ...

Issue with .get() method in jQuery affecting IE7, IE8, and IE9

While testing the sending and receiving of data to a PHP file using jQuery, I encountered an issue with Internet Explorer (I am using IE9, but I also checked on IE8 and IE7). When I click on one of my divs, I send an "ID" to the server and the PHP file re ...

Using jQuery, you can easily update the value of the nth-child(n) for a cloned element

Looking to duplicate an HTML element and assign new values to its child elements? Here's my current HTML structure: <div id="avator" class="avator" style="display:none"> <label><a href="/cdn-cgi/l/email-protection" class="__cf_email ...

In the event that the text within the span exceeds a certain length, replace it with dots rather than displaying the entire sentence

I'm looking for a different text clamping solution than the regular one. I don't want it to be like this: Really long sentence ---> Really long.... Instead, I only want 3 dots displayed as .... I've already experimented with using .trun ...

Saving HTML data into the WordPress database with the help of Ajax

After developing a WordPress plugin, I encountered an issue while working with div elements. My goal is to retrieve the content of a specific div using the following code snippet: var archive = j( "div.page2" ).html(); console.log(archive); Everything wo ...

The sixth character that is not in SGML format

I encountered a validation error while working on a website project Line 1, Column 1: non SGML character number 6 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.… In Firefox source viewer, certain lines are highlight ...

Eliminate the margin and padding on a floating table header

After scrolling, I am attempting to position the thead element. However, when changing the position from static to absolute, the element becomes offset with added margin and padding. This has led me to try using CSS to address the issue: To resolve this, ...

Accessibility issues detected in Bootstrap toggle buttons

I've been experimenting with implementing the Bootstrap toggle button, but I'm having an issue where I can't 'tab' to them using the keyboard due to something in their js script. Interestingly, when I remove the js script, I'm ...

Is it possible to combine sass and css files within the bower_components directory using gulp?

Using gulp-compass and gulp-postcss has been quite a challenge for me. I have been struggling to find the most efficient way to locate CSS files and their dependencies within the public folder, specifically in webroot/css using gulp. Below is an excerpt fr ...

What could be the reason for an iOS web app to become unresponsive on the initial loading screen?

I recently completed the development of an HTML5 webapp, and during my local server tests on desktop browsers, iOS Safari, and as a homescreen bookmark webapp, everything ran smoothly. The offline functionality with the cache.manifest file also worked flaw ...

Tips for Passing Multiple Variables in a Single Value in PHP

Within my PHP code, I have three requested variables that need to be handled: $boddate=$_REQUEST['boddate']; $bodmonth=$_REQUE`ST['bodmonth']; $bodyear=$_REQUEST['bodyear']; I would like to combine these three variables into ...

What is the method for determining the gaps between cells in a grid-based puzzle game similar to Sudoku?

this is my current code and it's successfully functioning var cellSize:Number = 36; var cellGap:Number = 4; var row:Number; var col:Number; for (var a:int = 0 ; a < puzzleSTR.length ; a++) { col = a % 9; row = Math.floor(a / 9); ...

"Setting a jQuery div to match the height of the window dynamically adjusts as content

I'm having trouble adjusting the height of my div to be equal to the window height minus the combined heights of the header and footer. I also want the contents inside the div to have a scroll bar if they exceed the specified height limit. While my cu ...

How to utilize PHP to create a multiple select form for filtering results in a MySQL

I have been attempting to create a query using the results from a search form. In my form, I have a field called "state". My goal is to allow users to select multiple states and receive a list of results that include all the selected states. Currently, I o ...

The issue with Framer motion's whileInView is that it does not animate the element when it is within the viewport in Next.js

In my current Next.js 14 project with the App Router, I decided to play around with animations using Framer Motion. One specific feature I wanted to implement was animating text elements into view as they enter the viewport. The idea is for the text to gra ...

The absence of an eye icon in the password field when using bootstrap 5

I'm having trouble positioning the eyeball icon to the right side of my form when using Bootstrap v5 and FontAwesome v5. Instead, the password field is being shifted further to the right compared to the username field, and the eye icon is not displayi ...