Investigation on a bug found in Chrome related to HTML, CSS, and printing

Currently, I am attempting to create a report using HTML and CSS. The structure of my template includes a header, content section, and footer. My goal is to have the headers and footers repeat across all pages similar to standard reports.

This is what my CSS code looks like:

Header:

@media print {
 div.report-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    padding-bottom: 15px;
    border-bottom: 2px solid #000034;
  }
}

Footer:

@media print {
  div.report-header {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    padding-bottom: 15px;
    border-bottom: 2px solid #000034;
  }
 }

When testing the report on Firefox, it functions as expected with the headers and footers repeating on every page. However, when viewed in Chrome, the header appears only on the first page, while the footer only shows up on the last page.

I've tried various tutorials, including utilizing Tables:

@media print {
  thead { display: table-header-group; width: 100%; background: red;}
  tfoot { display: table-footer-group; width: 100%; background: green;}
}

Despite these efforts, the issue persists, working correctly on Firefox but not on Chrome. Is there a specific solution or plugin that can help achieve this simple report layout consistently?

My current browser version is Chrome Version 24.0.1312.70.

Answer №1

From what I recall, this feature is only compatible with Firefox, Opera, and IE.

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

An additional pixel extending the entire width of 100%

I have a textarea that is 680 pixels wide, but I need to make it fluid by using percentages. When I use percentages to achieve a perfect 100% width, it seems to render 1 pixel more than it should. Here is the link to see the issue in action. ...

Integrating HTML elements based on scroll movement

Is there a way to dynamically add a new Bootstrap row to my HTML code when scrolling the mouse downward using JavaScript? <div class="row"> <div class="col-md-6 col-xs-6" > <div> <img src="img/picture1.jpg" a ...

Sharing a document that contains a linked image file using a relative path through the `publish` feature

I have reviewed the documentation and tested the steps provided in this example, but I am still unable to find a solution for the issue at hand. Based on the documentation, the image file should either be located in the same path as the MATLAB script bein ...

Managing text size in HTML email designs

How can I maintain consistent font sizes in HTML EMAILS? The fonts look great on the website, but in my email they appear small and close together. Check out Live Demo I've attached a screenshot of how the email appears to me. Any suggestions on h ...

How can I randomly choose 5 TR items and show them to the user?

How can I randomly select and display 5 questions for the user? The rest of the questions should be hidden on the page and only 5 questions should be displayed. This is a sample code. I want the user to see 5 questions out of many questions when the page ...

Spinning Text with Dynamic jQuery Effects

I am looking to add a creative typography effect by rotating a portion of a sentence. I have experimented with jQuery animations. Specifically, I am interested in animating a word upwards. Here is the code snippet I have been working on: window.setInterv ...

Dual scrollbars and a collapsing toolbar

Currently immersed in the development of a photo gallery using AngularJS and Angular Material (expand to fullscreen to observe the issue). var app = angular.module('app', ['ngMaterial']); app.controller('TitleController', f ...

Uploading images using Ajax with HTML and PHP

I'm facing a small issue with a multi-image upload feature. Everything works perfectly when I select multiple photos, but if I upload three pictures and then add another one, only the last picture is taken into account. For example https://i.sstatic.n ...

When a media query is activated, the Flex item mysteriously vanishes from

UPDATE I followed the suggestion in Ezra Siton's answer and changed the media query display to block, which successfully resolved the issue! Within my html code, I have a parent column flexbox containing two children. The second child is itself anoth ...

What methods can be used to control the URL and back button in a web application designed similar to an inbox in Gmail?

Similar Question: Exploring AJAX Techniques in Github's Source Browser In my application, there are essentially 2 main pages: The main page displays a list of applications (similar to an inbox) The single application page is packed with various ...

Guide on transforming a Java multiclass applet into an HTML file

Can someone help me with converting three Java classes saved as .java into an applet in HTML? I've been advised to convert it to a .jar file, but I'm not sure how to do that. Can anyone provide a step-by-step guide, preferably using NetBeans? ...

Tracking changes in real time and calculating the sum with AJAX, PHP, and MySQL for efficient processing

Initially, I kindly request you to read this until the end. I am in dire need of assistance with my problem as I have searched for solutions but still remain clueless. https://i.sstatic.net/DAb1q.png Referring to the image provided, the first 'Produ ...

Ensure that the WebRTC video stream content is centered when displaying a tall video on a wide screen

Currently, I am encountering an issue while making a webrtc video call between a mobile device in portrait mode and a laptop. The streams from the mobile and the laptop have different aspect ratios, causing challenges when trying to display the video fulls ...

Guidelines for using a video as a background on half of the page

Is it possible to have a video background take up half of the screen on a homepage? Currently, I am using Bootstrap 4's grid system to divide the page and using html5 to implement the video. <div class="container-fluid"> <div class="row ...

Retrieve the HTML tag content as a string using jQuery

For my OSINT project, I am developing a tool that needs to extract text from a specific HTML code string. $("p").text(); I'm looking for a way to make my variable work with the above code. Any suggestions? Share your ideas! Solution: $.ajax({ ...

Transmitting HTML5 application settings via URL

I am interested in creating an HTML5 app that utilizes the WebAudio API. This app will allow users to customize certain parameters. Users should be able to 'share' these settings by sending a share URL, which can be clicked by others to view the ...

Example of using the CSS property white-space with break-spaces

I've been searching for an example of using css white-space: break-spaces for hours with no luck. Most tutorials only cover examples for normal, nowrap, pre, pre-wrap, pre-line. When it comes to break-spaces, the information available is limited to qu ...

Adjusting the background color of an HTML element with CSS through the power of Javascript

I am looking to dynamically change the background color of an element in CSS using JavaScript when a button is clicked. Currently, my CSS code looks like this: div.box { width:100px; height:100px; background-color:#FF2400; } I want the backg ...

What is the best way to allocate a unique color to every item within an array?

I've been working on some JavaScript code that pulls a random color from a selection: const colors = [blue[800], green[500], orange[500], purple[800], red[800]]; const color = colors[Math.floor(Math.random() * colors.length)]; Within my JSX code, I ...

The issue of variable being displayed as undefined is often due to JavaScript hoisting mechanisms

UPDATE: After diagnosing the issue, I discovered that the #t01 ID is inaccessible within the ajax success function which is why nothing is being displayed. This is related to a concept known as JavaScript hoisting. Unfortunately, I couldn't find a sol ...