Breaking the page with HTML and CSS

* {
    box-sizing: border-box;
}

.row {
    display: flex;
}

/* Creating two equal columns that sit side by side */
.column {
    flex: 50%;
    padding: 10px;
   
}

div.row { 
  page-break-after: always; 
}
<body>

<div<div class="row">
  <div class="column" >
     <p><h2>101</h2>
<img src="http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/33.64188,-84.50077/7?mapSize=500,500&pp=33.64188,-84.50077;21;1&pp=33.76768,-84.36031;;2&key=ArJkybJp6LvcJs7su6sKIQMBnwYngXlhGIjE5aWRApleSq6DkWzGNm5j80Lb-WZt">
<h6>YES/NO 1. x? </br>
YES/NO 2. x?</br>
YES/NO 3. x?</br>
YES/NO 4. x?</br>
YES/NO 5. x?</br>
YES/NO 6. x?</h6><h5>________________________________________________________________________</br>
 Signature                                       Date</br></h5>
<h5>________________________________________________________________________</br>
 Signature                                       Date,</br></h5>
<h5>________________________________________________________________________</br>
 Signature                                       Date</br></h5>
<h5>________________________________________________________________________</br>
 Signature                                       Date</br></h5></p>
  </div>
 <div class="column" style="width: 1000; align: top;" >
    <p>
<table>
<tr><th>Stop Number</th><th>Address</th><th>Zip</th><th>Arrival</th>
<tr>
<td>0</td>
<td>11111</td>
<td>22222</td><td>2:30</td></tr>
<tr><td>1</td>
<td>11111</td>
<td>22222</td>
<td>4:00</td></tr>
</table>
</p>
</div>
</div>

<p style="page-break-after: always;">&nbsp;</p>


<div class="row">
  <div class="column" >
     <p><h2>02</h2>
<img src="http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/33.64188,-84.50077/7?mapSize=500,500&pp=33.64188,-84.50077;21;1&pp=33.76768,-84.36031;;2&key=ArJkybJp6LvcJs7su6sKIQMBnwYngXlhGIjE5aWRApleSq6DkWzGNm5j80Lb-WZt">
<h6>YES/NO 1. x? </br>
YES/NO 2. x?</br>
YES/NO 3. x?</br>
YES/NO 4. x?</br>
YES/NO 5. x?</br>
YES/NO 6. x?</h6><h5>________________________________________________________________________</br>
 Signature                                       Date</br></h5>
<h5>________________________________________________________________________</br>
 Signature                                       Date,</br></h5>
<h5>________________________________________________________________________</br>
 Signature                                       Date</br></h5>
<h5>________________________________________________________________________</br>
 Signature                                       Date</br></h5></p>
  </div>
 <div class="column" >
    <p>
<table>
<tr><th>Stop Number</th><th>Address</th><th>Zip</th><th>Arrival</th>
<tr>
<td>0</td>
<td>11111</td>
<td>22222</td><td>2:30</td></tr>
<tr><td>1</td>
<td>11111</td>
<td>22222</td>
<td>4:00</td></tr>
</table>
</p>
</div>
</div>

<p style="page-break-after: always;">&nbsp;</p>

</body>

I have designed a webpage with dual columns and require a break after the first section to print the following two columns on a separate page. However, I am facing difficulty in implementing the page break, as both columns continue to appear sequentially without the desired break. The columns are visually satisfactory, but I specifically need the page separation. I have experimented with adding an empty div between the sections along with the corresponding CSS:

CSS

div.row { 
  page-break-after: always;

HTML

<div class="pagebreak"> </div>

In addition, I attempted

<p style="page-break-after: always;">&nbsp;</p>

However, instead of achieving a break after the second column, it results in all four columns displayed on one page.

What crucial element am I overlooking?

Answer №1

For block elements that generate a box, this property is relevant - however, it will not apply to an empty div that does not generate a box. Make sure to add some content within your .row div for it to take effect.

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

What is the best way to adjust a CSS width using the output from a JavaScript function?

I am facing a challenge with a GridView within a div wrapper. The row headers along the left side need to always be visible. So far, this setup is working fine. However, I need the wrapper to have a variable width to adjust to the browser size. Although I ...

Creating a sleek grayscale effect when hovering with CSS is both simple and effective

My website features a grayscale logo that smoothly transitions to color upon hover. However, I am experiencing some issues with the smoothness of this transition when using CSS. Here is my current code: <img alt="TT ltd logo" src="./img/tt-logo.png" c ...

Add a new row to the table when a dropdown option is selected, and remove the row when deleted. Ensure that the row is only added

Here is my specific requirement: I need a table with a default row containing a dropdown menu in the first column. When an option is selected from the dropdown, a new table row should be added with the same content as the main row and a delete button for ...

The class styling is malfunctioning

When I click the 'night' button, I want the word color in the class=css to change to white. However, this is not working as intended, even though all other word colors are changing correctly. Here is my code: .css { font-weight: bold; ...

Creating Table Rows on-the-fly

Seeking assistance and guidance from the community, I have modified code from an online tutorial to allow users to dynamically add rows to a table when data is entered in the row above. However, I am facing an issue where I can only insert one additional ...

Conceal the calendar icon from the date-type HTML input field specifically on the Firefox

The situation at hand is quite straightforward. <input type="date /> When viewed on Firefox (both desktop and mobile), it appears as follows: https://i.stack.imgur.com/S2i0s.png While the internet provides a solution specifically for Chrome: ...

Creating characters dynamically based on the length of user input in VSCode Snippet

Here is a simple vue-html snippet: { "BANNER1": { "prefix": "banner", "body": ["<!-- ----------------", "/// $1", "--------------------- -->"] } } This sni ...

Using jQuery to locate a JavaScript variable is a common practice in web development

I recently created a JSFiddle with buttons. As part of my journey to learn jQuery, I have been converting old JavaScript fiddles into jQuery implementations. However, I seem to be facing a challenge when it comes to converting the way JavaScript fetches an ...

Add the variable's value to the input field

It is necessary for me to concatenate a numeric value, stored in a variable, with the input fields. For example: var number = 5; var text = $("#dropdown_id").val(); I wish to append the value of the variable 'number' to 'dropdown_id' ...

What steps can be taken to modify the `select` element in IE?

I came across a solution to display an arrow on a select element in this answer: select { width: 268px; padding: 5px; font-size: 16px; line-height: 1; border: 0; border-radius: 5px; height: 34px; background: url(http://cdn1 ...

Ways to ensure a ul li element perfectly fits inside a div element without any spaces

As a newcomer to CSS and HTML, I'm facing an issue with my ul li dropdown menu and login boxes. The background colors are red and blue, but there are gaps within the div that I want to fill with the height of the div. Below is the code snippet: @key ...

Avoid placing the label within a form-inline in Bootstrap to maintain proper formatting and alignment

I am working on a form where I have two fields inline within a form-inline div. I am looking to move the labels of these fields above them rather than next to them. How can I achieve this without affecting the layout of the fields? Here is a CodePen link ...

Instructions on utilizing the CSSStyleSheet.insertRule() method for modifying a :root attribute

Is it possible to dynamically set the background color of the :root CSS property in an HTML file based on a hash present in the URL? The code provided does change the background color, but unfortunately, the hash value doesn't persist as users navigat ...

Modify CSS when scrolling, based on the size of the screen

I've implemented this JQuery script to modify elements in my header as the user scrolls. Is there a way to limit these modifications based on the screen size? Here's the code snippet: $(window).scroll(function() { // Once the user has scro ...

Nested Property Binding in CallByName

I am looking to utilize CallByName in VBA to extract specific data from various webpages with differing html structures. In my scenario, I need to reference multiple parent nodes to access an element with or tags. Here is an example of the code: The eleme ...

Preventing ReactJS tooltips from exceeding the boundaries of the screen

Here is a simple demo showcasing blocks with tooltips that appear when hovered over. However, there seems to be an issue with the functionality. The tooltip should ideally be displayed either from the left or right side of the block. To determine the size ...

What is the best way to incorporate an exception for the printThis() element?

Is there a way to exclude a specific div from being printed when using the printThis() function? For example: <div id="print-it"> <div>hello</div> <div id="no-print-this"> <button>must be show on page but not print</but ...

Deciding the source URLs for external iframes

Is it possible to detect the URL displayed in an iframe? How can we ensure that links within an iframe open in a new tab/window? Moreover, is there a way to achieve this even with the same-origin policy for external frames? If not, what causes this violat ...

Discrepancies in Video Element Size: Mobile Versus Desktop

Why does the video element have different sizing behavior between mobile and desktop? I noticed on this website that on desktop Chrome, its width is about 35% of the browser while on iPad Chrome it's only about 10% Does anyone know why this is happen ...

Issue with enlarging images using UL and LI tags persists

After implementing the code for a simple image enlarge feature (showing a QR code image when the user hovers over the icon), I noticed an issue. Interestingly, the same code is used on two designs, but it's not working on one of them. To view the pr ...