If the content on the first page overflows, the header and footer should be repeated

Despite trying other solutions, my question may seem similar to others. In my case, I utilized the header as a static header for printing, a div element as my footer, and a table to display the content.

The issue I am facing is that when attempting to print the page, if the table's content overflows, it spills onto the second page. I aim to have the overflow content from the table on the first page automatically flow to the second page while ensuring that the header and footer remain visible on both pages.

HEADER

<header>
    <center><h3><b>Miguel Enrique</b></h3>                  
    <p><i>Diplomat<br>Fellow</i><br>Orthopaedic Surgeon</p>         
    </center>
</header>
<div class="row uniform half collapse-at-2">
  <div class="12u">                                     
    <center><h4><b>---data----</b></h4></center>
    <h4><p>------DATA--------------<br>Tel. 77 19 349 | 65 90 097
    <br>Mon<b>&middot;</b>Wed<b>&middot;</b>Fri  |  3:00pm - 5:00pm
    <br>Tues<b>&middot;</b>Thurs<b>&middot;</b>Sat  |  11:00am - 2:00pm  | 
    <br>  (All by appointment)</p></h5>
  </div>
  <div class="6u">
    <div class="row uniform half">
        <div class="12u">
        <center><h4><b>--DATA---</b></h4></center>                                                      
        <h5><p>  ------DATA-------
        <br>Tel. No. : (632) 789 - 7700 loc. 7330
        <br>Mon-Thurs: 11am - 4pm  |  (by Appointment)</p><h5>
        </div>                              
    </div>
  </div>
<div    

BODY

<table class="print">
   <thead>
        <tr>
            <th scope="col"><b>No.</b></th>
            <th scope="col"><b>Prescriptions</b></th>
        </tr>
   </thead>
    <tbody>                                         
        <?php foreach($new_array2 as  $value) { $inc = @$inc + 1;?>
        <tr>
            <td><?php echo $inc; $prescription_array=explode('/',$value);?>
            </td>
            <td><?php foreach($prescription_array as $value2) 
              { echo "<h5>".$value2."</h5>";
            } ?>
            </td>
        </tr>
            <?php }?>
   </tbody>                                                                 
</table>

FOOTER

<div class="row uniform half collapse-at-2">
    <div class="12u">                       
        <div class="row uniform half">
           <font size="5"><b>Name</b></font><br>
            License No. : 1<br>
        </div>
    </div>
</div>

Is there a solution to this issue? I want the overflowing content to seamlessly transition to the next page while maintaining the visibility of the header and footer across pages. https://i.sstatic.net/DYIjR.png

The first image demonstrates the current printing behavior, while the second picture depicts the desired output. Is achieving this layout possible in Google Chrome?

Answer №1

Check out this code snippet:

header

<header>  
    <center><h3><b>Miguel Enrique</b></h3>                  
    <p><i>Diplomat<br>Fellow</i><br/>Orthopaedic Surgeon</p>         
    </center>
</header>
<div class="row uniform half collapse-at-2">
  <div class="12u">                                     
    <center><h4><b>---data----</b></h4></center>
    <h4><p>------DATA--------------<br/>
        Tel. 77 19 349 | 65 90 097<br/>
        Mon<b>&middot;</b>Wed<b>&middot;</b>Fri  |  3:00pm - 5:00pm<br/>
        Tues<b>&middot;</b>Thurs<b>&middot;</b>Sat  |  11:00am - 2:00pm  |<br/> 
        (All by appointment)</p>
    </h4>
  </div>
  <div class="6u">
    <div class="row uniform half">
        <div class="12u">
            <center><h4><b>--DATA---</b></h4></center>                                                      
            <h5><p>  ------DATA-------<br/>
            Tel. No. : (632) 789 - 7700 loc. 7330<br/>
            Mon-Thurs: 11am - 4pm  |  (by Appointment)</p></h5>
        </div>                              
    </div>
  </div>
</div>

body

<table class="print">
    <thead>
        <tr>
            <th scope="col"><b>No.</b></th>
            <th scope="col"><b>Prescriptions</b></th>
        </tr>
    </thead>
    <tbody>                                         
        <?php 
        foreach($new_array2 as  $value) 
            { 
                $inc = @$inc + 1;
        ?>
        <tr>
            <td>
                <?php 
                    echo $inc; 
                    $prescription_array=explode('/',$value);
                ?>
            </td>
            <td>
                <?php 
                    foreach($prescription_array as $value2) 
                        { 
                            echo "<h5>".$value2."</h5>";
                        } 
                ?>
            </td>
        </tr>
        <?php 
            }
        ?>
   </tbody>                                                                 
</table>

footer

<div class="row uniform half collapse-at-2">
    <div class="12u">                       
        <div class="row uniform half">
           <font size="5"><b>Name</b></font><br/>
            License No. : 1<br/>
        </div>
    </div>
</div>

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

Learn how to use fabric.js to layer a png image over a canvas and create a mask effect

https://i.sstatic.net/yT16J.png Is there a way to mask all canvas objects using a single layer? I have a png file that I want to use as a layer, which I load from a URL. What would be the best approach to achieve this? I have tried one method where I cli ...

The way images appear can vary between desktop and mobile devices

I am in the process of creating a photography website with a simple goal of displaying images down the page one after another. However, I am encountering issues with uniform display across various desktop and mobile platforms. The site appears perfect on i ...

Enhancing Your Website with Interactive Highlighting Tags

Looking at the following html: Let's see if we can <highlight data-id="10" data-comment="1"> focus on this part only </highlight> and ignore the rest My goal is to emphasize only the highlight section. I know how to emphasize a span ...

Place the image either above or below the text in a relative position

I have a peculiar dilemma that has been on my mind lately. As I work on designing my website, I am nearing completion of the responsive/mobile view. Currently, everything looks fine, but only because I use display: none; to hide images when the viewport is ...

Capture audio using a web browser

Currently working on a project to create a platform for recording sounds. I'm aiming to incorporate a meter that measures the volume of the sound. Despite extensive research, I haven't been able to discover an HTML5 solution compatible with all b ...

Is it possible to shift the "ul" block of the navigation bar to the right without compromising the responsiveness toggle button functionality?

I'm currently using bootstrap NavBar and encountering an issue where moving the ul block to the right is disabling the toggle button responsiveness. <head> <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" c ...

Browser comparison: Chrome and Firefox - peculiar ID name causing table width difference without CSS. Suspected AdBlocking interference

There seems to be an issue with a table I have in Chrome. Whenever I change the ID name, it either sets the width to zero or doesn't display at all. You can view it here: http://jsfiddle.net/kdubs/W6GTE/ The specific line causing trouble is: <ta ...

The JS Fiddle code fails to function properly once it has been downloaded to the local computer

I came across a helpful example fiddle webpage: jsfiddle.net/yijiang/6FLsM/2 After following examples from others, I attempted to download (right click and Save As) using the latest Chrome browser with the following links: jsfiddle.net/yijiang/6FLsM/2/s ...

When developing a website in Sitecore 8, the link consistently opens in a new window rather than a new tab, even after including the target="_blank" attribute

When using Sitecore-8 CMS, external links are set to open in a new window instead of a new tab in Internet Explorer 10 and IE 9, even when target="_blank" is included in the href tag. We are seeking a solution to address this issue. Any assistance would b ...

Is there a way in Angular2 to append a class name from a variable to the host element without removing the current classes?

I am facing a challenge where I have a class name stored in a variable and I need to apply it to the host element of my Angular2 component. However, I am struggling to find a solution for this. While I can easily add a constant string as a class using Hos ...

The background color of the columns is overwhelming

I would like to create a TV remote control design using bootstrap, but I am encountering some issues. The background color is overflowing and I'm unsure how to fix it. Please take a look at the code and feel free to offer any suggestions! @media scre ...

Trouble with Fancybox 2 and CSS classes not applying correctly

Despite my previous successful experiences with fancybox, I am currently facing an issue where the CSS styling is not being applied as expected. The large images appear grouped correctly, but without any styling, causing them to shift to the right after ap ...

Tips for creating floating and right-aligned notifications using CSS in Vue.js

Struggling to position my basic notification component in the top right corner. Here is my HTML: <div class="notifications"> <p>{{ notification.message }}</p> </div> This is my notifications class: .notifications { position: ...

Gitbook is facing a unique challenge with the Chinese language in its HTML code - an issue with excessive spacing

Currently, I am utilizing gitbook and github pages to construct my personal webpage with the main language being Chinese. However, I have noticed that gitbook is adding an extra space in some places where it is unnecessary. Below is the text found in the m ...

Styling the tab view in PrimeFaces

I am currently working with the tab view feature in primefaces and I have encountered a couple of issues. 1) When using Internet Explorer, the tabs are displayed vertically instead of horizontally. However, it works fine in Firefox. FireFox : Internet E ...

Alignment dilemmas

I'm experimenting with HTML and CSS and have a query concerning the text-align properties. As I work on constructing my personal website, I aim to align text content to start while having it centered in the middle of the page. Currently, I've ma ...

What could be the reason for the extra tags being returned by YQL?

Currently, I am executing a query in the YQL console with the following data: select * from html where url='http://www.motorni-masla.net/index.php?main_page=product_oil_info&cPath=140&products_id=294&zenid=c8281021bbfed454176247900b3b9d4a ...

Designate the preferred location for requesting the desktop site

Is there a way to specify the location of the 'Request desktop site' option? Here is the code I am currently using: var detector = new MobileDetect(window.navigator.userAgent); if(detector.mobile() != null || detector.phone() != null || det ...

The image fails to display correctly

As I work on creating a basic webpage in HTML and JavaScript, my goal is to validate certain parameters (such as width, height) of an image that users upload via a form. In JavaScript, I extract the file from the form and attempt to display it as an image ...

CSS for Page Header with Scroll-Over Content

Having trouble creating a "collapsing header" design where the page content scrolls over the banner image. I've tried adjusting z-index and positioning properties in CSS, but can't achieve the desired effect. Any help or guidance would be greatly ...