Listing X divs for print on A4 paper
I have a range of products in categories that i need printed on paper as a order sheet.
My idea was to get the following layout (landscaped):
Page 1:
+-----------+
| 1 | 4 | 7 |
| 2 | 5 | 8 |
| 3 | 6 | 9 |
+-----------+
Page 2:
+-----------+
| 10| 13| 16|
| 11| 14| 17|
| 12| 15| 18|
+-----------+
The CSS I've tried so far does not work for me.
Current CSS:
<style type="text/css">
@media print {
.noprint {
display:none;
}
}
.info {
width: 100%;
padding: 25px;
font-size: 20px;
border: 3px solid #000;
text-align: center;
margin-bottom: 30px;
}
.image {
text-align: center;
padding: 20px;
}
* {
box-sizing: border-box;
}
body {
font-family: verdana;
font-size: 12px;
}
.category {
column-count: 3;
column-gap: 20px;
}
.items {
column-count: 3;
column-gap: 20px;
column-fill: auto;
height: 80vh;
}
.page {
page-break-after: always;
clear: both;
}
.item {
width: 100%;
margin: 0;
}
.header {
width: 100%;
}
.header > * {
float: left;
background-color: #E0E0E0;
padding: 5px;
}
.name_header {
width: 70%;
font-weight: bold;
text-align:center;
font-size: 15px;
float: left;
}
.pieces_header {
width: 30%;
font-weight: bold;
text-align:center;
font-size: 15px;
float: left;
}
.product {
width: 100%;
margin: 0;
-webkit-column-break-inside: avoid; /* Chrome, Safari */
page-break-inside: avoid; /* Theoretically FF 20+ */
break-inside: avoid-column; /* IE 11 */
display:table;
border-top: 1px solid #000;
border-bottom: 1px solid #000;
}
.name {
width: 50%;
float: left;
height: 40px;
line-height: 40px;
}
.price {
width: 25%;
float: left;
height: 40px;
line-height: 40px;
text-align: right;
}
.pieces {
width: 25%;
float: left;
height: 40px;
}
.barcode {
width: 100%;
text-align: center;
}
</style>
.page is inserted for every 25. product as a
Each .barcode div holds a products EAN13 as XML.
One product loop:
<div class="items">
<div class="item header">
<div class="name_header">Andet</div>
<div class="pieces_header">Antal</div>
</div>
<div class="item product">
<div class="name">13</div>
<div class="price">kr. 29,95</div>
<div class="pieces"></div>
<div class="barcode">
</div>
</div>
</div>
</div>
html css
add a comment |
I have a range of products in categories that i need printed on paper as a order sheet.
My idea was to get the following layout (landscaped):
Page 1:
+-----------+
| 1 | 4 | 7 |
| 2 | 5 | 8 |
| 3 | 6 | 9 |
+-----------+
Page 2:
+-----------+
| 10| 13| 16|
| 11| 14| 17|
| 12| 15| 18|
+-----------+
The CSS I've tried so far does not work for me.
Current CSS:
<style type="text/css">
@media print {
.noprint {
display:none;
}
}
.info {
width: 100%;
padding: 25px;
font-size: 20px;
border: 3px solid #000;
text-align: center;
margin-bottom: 30px;
}
.image {
text-align: center;
padding: 20px;
}
* {
box-sizing: border-box;
}
body {
font-family: verdana;
font-size: 12px;
}
.category {
column-count: 3;
column-gap: 20px;
}
.items {
column-count: 3;
column-gap: 20px;
column-fill: auto;
height: 80vh;
}
.page {
page-break-after: always;
clear: both;
}
.item {
width: 100%;
margin: 0;
}
.header {
width: 100%;
}
.header > * {
float: left;
background-color: #E0E0E0;
padding: 5px;
}
.name_header {
width: 70%;
font-weight: bold;
text-align:center;
font-size: 15px;
float: left;
}
.pieces_header {
width: 30%;
font-weight: bold;
text-align:center;
font-size: 15px;
float: left;
}
.product {
width: 100%;
margin: 0;
-webkit-column-break-inside: avoid; /* Chrome, Safari */
page-break-inside: avoid; /* Theoretically FF 20+ */
break-inside: avoid-column; /* IE 11 */
display:table;
border-top: 1px solid #000;
border-bottom: 1px solid #000;
}
.name {
width: 50%;
float: left;
height: 40px;
line-height: 40px;
}
.price {
width: 25%;
float: left;
height: 40px;
line-height: 40px;
text-align: right;
}
.pieces {
width: 25%;
float: left;
height: 40px;
}
.barcode {
width: 100%;
text-align: center;
}
</style>
.page is inserted for every 25. product as a
Each .barcode div holds a products EAN13 as XML.
One product loop:
<div class="items">
<div class="item header">
<div class="name_header">Andet</div>
<div class="pieces_header">Antal</div>
</div>
<div class="item product">
<div class="name">13</div>
<div class="price">kr. 29,95</div>
<div class="pieces"></div>
<div class="barcode">
</div>
</div>
</div>
</div>
html css
What is the CSS you've tried, any what isn't working? Also, you'll need to post your HTML.
– Toby
Dec 28 '18 at 0:43
add a comment |
I have a range of products in categories that i need printed on paper as a order sheet.
My idea was to get the following layout (landscaped):
Page 1:
+-----------+
| 1 | 4 | 7 |
| 2 | 5 | 8 |
| 3 | 6 | 9 |
+-----------+
Page 2:
+-----------+
| 10| 13| 16|
| 11| 14| 17|
| 12| 15| 18|
+-----------+
The CSS I've tried so far does not work for me.
Current CSS:
<style type="text/css">
@media print {
.noprint {
display:none;
}
}
.info {
width: 100%;
padding: 25px;
font-size: 20px;
border: 3px solid #000;
text-align: center;
margin-bottom: 30px;
}
.image {
text-align: center;
padding: 20px;
}
* {
box-sizing: border-box;
}
body {
font-family: verdana;
font-size: 12px;
}
.category {
column-count: 3;
column-gap: 20px;
}
.items {
column-count: 3;
column-gap: 20px;
column-fill: auto;
height: 80vh;
}
.page {
page-break-after: always;
clear: both;
}
.item {
width: 100%;
margin: 0;
}
.header {
width: 100%;
}
.header > * {
float: left;
background-color: #E0E0E0;
padding: 5px;
}
.name_header {
width: 70%;
font-weight: bold;
text-align:center;
font-size: 15px;
float: left;
}
.pieces_header {
width: 30%;
font-weight: bold;
text-align:center;
font-size: 15px;
float: left;
}
.product {
width: 100%;
margin: 0;
-webkit-column-break-inside: avoid; /* Chrome, Safari */
page-break-inside: avoid; /* Theoretically FF 20+ */
break-inside: avoid-column; /* IE 11 */
display:table;
border-top: 1px solid #000;
border-bottom: 1px solid #000;
}
.name {
width: 50%;
float: left;
height: 40px;
line-height: 40px;
}
.price {
width: 25%;
float: left;
height: 40px;
line-height: 40px;
text-align: right;
}
.pieces {
width: 25%;
float: left;
height: 40px;
}
.barcode {
width: 100%;
text-align: center;
}
</style>
.page is inserted for every 25. product as a
Each .barcode div holds a products EAN13 as XML.
One product loop:
<div class="items">
<div class="item header">
<div class="name_header">Andet</div>
<div class="pieces_header">Antal</div>
</div>
<div class="item product">
<div class="name">13</div>
<div class="price">kr. 29,95</div>
<div class="pieces"></div>
<div class="barcode">
</div>
</div>
</div>
</div>
html css
I have a range of products in categories that i need printed on paper as a order sheet.
My idea was to get the following layout (landscaped):
Page 1:
+-----------+
| 1 | 4 | 7 |
| 2 | 5 | 8 |
| 3 | 6 | 9 |
+-----------+
Page 2:
+-----------+
| 10| 13| 16|
| 11| 14| 17|
| 12| 15| 18|
+-----------+
The CSS I've tried so far does not work for me.
Current CSS:
<style type="text/css">
@media print {
.noprint {
display:none;
}
}
.info {
width: 100%;
padding: 25px;
font-size: 20px;
border: 3px solid #000;
text-align: center;
margin-bottom: 30px;
}
.image {
text-align: center;
padding: 20px;
}
* {
box-sizing: border-box;
}
body {
font-family: verdana;
font-size: 12px;
}
.category {
column-count: 3;
column-gap: 20px;
}
.items {
column-count: 3;
column-gap: 20px;
column-fill: auto;
height: 80vh;
}
.page {
page-break-after: always;
clear: both;
}
.item {
width: 100%;
margin: 0;
}
.header {
width: 100%;
}
.header > * {
float: left;
background-color: #E0E0E0;
padding: 5px;
}
.name_header {
width: 70%;
font-weight: bold;
text-align:center;
font-size: 15px;
float: left;
}
.pieces_header {
width: 30%;
font-weight: bold;
text-align:center;
font-size: 15px;
float: left;
}
.product {
width: 100%;
margin: 0;
-webkit-column-break-inside: avoid; /* Chrome, Safari */
page-break-inside: avoid; /* Theoretically FF 20+ */
break-inside: avoid-column; /* IE 11 */
display:table;
border-top: 1px solid #000;
border-bottom: 1px solid #000;
}
.name {
width: 50%;
float: left;
height: 40px;
line-height: 40px;
}
.price {
width: 25%;
float: left;
height: 40px;
line-height: 40px;
text-align: right;
}
.pieces {
width: 25%;
float: left;
height: 40px;
}
.barcode {
width: 100%;
text-align: center;
}
</style>
.page is inserted for every 25. product as a
Each .barcode div holds a products EAN13 as XML.
One product loop:
<div class="items">
<div class="item header">
<div class="name_header">Andet</div>
<div class="pieces_header">Antal</div>
</div>
<div class="item product">
<div class="name">13</div>
<div class="price">kr. 29,95</div>
<div class="pieces"></div>
<div class="barcode">
</div>
</div>
</div>
</div>
html css
html css
edited Dec 28 '18 at 1:06
asked Dec 28 '18 at 0:41
apocs
255
255
What is the CSS you've tried, any what isn't working? Also, you'll need to post your HTML.
– Toby
Dec 28 '18 at 0:43
add a comment |
What is the CSS you've tried, any what isn't working? Also, you'll need to post your HTML.
– Toby
Dec 28 '18 at 0:43
What is the CSS you've tried, any what isn't working? Also, you'll need to post your HTML.
– Toby
Dec 28 '18 at 0:43
What is the CSS you've tried, any what isn't working? Also, you'll need to post your HTML.
– Toby
Dec 28 '18 at 0:43
add a comment |
1 Answer
1
active
oldest
votes
Here's an example that works on screen, and should work in print:
body { margin: 0 }
@media screen {
.container {
display: flex;
flex-direction: column;
height: 100vh;
flex-wrap: wrap;
}
.container div {
box-sizing: border-box;
height: 33.3vh;
border: 1px solid red;
}
}
@media print {
.container {
display: flex;
flex-direction: column;
height: 100vh;
flex-wrap: wrap;
}
.container div {
box-sizing: border-box;
height: 33.3vh;
border: 1px solid red;
}
}
<div class="container">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
</div>
Note I have not used your code in order to keep the mechanics clear. See it working here:
http://jsfiddle.net/tobyl/bec6sryf/10/
Something to bear in mind, since you have a specific page size you'd like to target, in print you can always specify the dimensions in millimetres:
@media print {
.container {
display: flex;
flex-direction: column;
height: 297mm;
flex-wrap: wrap;
}
.container div {
box-sizing: border-box;
height: 99mm;
width: 70mm;
border: 1px solid red;
}
}
Again, this is pseudo code - in reality, you'll want to account for headers and footers and margins, but this should provide a good starting point.
Thank you very much for a much cleaner solution. However, this causes the content to overflow the page to the right and not be included in the print.
– apocs
Dec 28 '18 at 9:59
As noted at the bottom of my answer, you'll need to adjust sizing to account for margins.
– Toby
Dec 28 '18 at 12:59
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53952446%2flisting-x-divs-for-print-on-a4-paper%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here's an example that works on screen, and should work in print:
body { margin: 0 }
@media screen {
.container {
display: flex;
flex-direction: column;
height: 100vh;
flex-wrap: wrap;
}
.container div {
box-sizing: border-box;
height: 33.3vh;
border: 1px solid red;
}
}
@media print {
.container {
display: flex;
flex-direction: column;
height: 100vh;
flex-wrap: wrap;
}
.container div {
box-sizing: border-box;
height: 33.3vh;
border: 1px solid red;
}
}
<div class="container">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
</div>
Note I have not used your code in order to keep the mechanics clear. See it working here:
http://jsfiddle.net/tobyl/bec6sryf/10/
Something to bear in mind, since you have a specific page size you'd like to target, in print you can always specify the dimensions in millimetres:
@media print {
.container {
display: flex;
flex-direction: column;
height: 297mm;
flex-wrap: wrap;
}
.container div {
box-sizing: border-box;
height: 99mm;
width: 70mm;
border: 1px solid red;
}
}
Again, this is pseudo code - in reality, you'll want to account for headers and footers and margins, but this should provide a good starting point.
Thank you very much for a much cleaner solution. However, this causes the content to overflow the page to the right and not be included in the print.
– apocs
Dec 28 '18 at 9:59
As noted at the bottom of my answer, you'll need to adjust sizing to account for margins.
– Toby
Dec 28 '18 at 12:59
add a comment |
Here's an example that works on screen, and should work in print:
body { margin: 0 }
@media screen {
.container {
display: flex;
flex-direction: column;
height: 100vh;
flex-wrap: wrap;
}
.container div {
box-sizing: border-box;
height: 33.3vh;
border: 1px solid red;
}
}
@media print {
.container {
display: flex;
flex-direction: column;
height: 100vh;
flex-wrap: wrap;
}
.container div {
box-sizing: border-box;
height: 33.3vh;
border: 1px solid red;
}
}
<div class="container">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
</div>
Note I have not used your code in order to keep the mechanics clear. See it working here:
http://jsfiddle.net/tobyl/bec6sryf/10/
Something to bear in mind, since you have a specific page size you'd like to target, in print you can always specify the dimensions in millimetres:
@media print {
.container {
display: flex;
flex-direction: column;
height: 297mm;
flex-wrap: wrap;
}
.container div {
box-sizing: border-box;
height: 99mm;
width: 70mm;
border: 1px solid red;
}
}
Again, this is pseudo code - in reality, you'll want to account for headers and footers and margins, but this should provide a good starting point.
Thank you very much for a much cleaner solution. However, this causes the content to overflow the page to the right and not be included in the print.
– apocs
Dec 28 '18 at 9:59
As noted at the bottom of my answer, you'll need to adjust sizing to account for margins.
– Toby
Dec 28 '18 at 12:59
add a comment |
Here's an example that works on screen, and should work in print:
body { margin: 0 }
@media screen {
.container {
display: flex;
flex-direction: column;
height: 100vh;
flex-wrap: wrap;
}
.container div {
box-sizing: border-box;
height: 33.3vh;
border: 1px solid red;
}
}
@media print {
.container {
display: flex;
flex-direction: column;
height: 100vh;
flex-wrap: wrap;
}
.container div {
box-sizing: border-box;
height: 33.3vh;
border: 1px solid red;
}
}
<div class="container">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
</div>
Note I have not used your code in order to keep the mechanics clear. See it working here:
http://jsfiddle.net/tobyl/bec6sryf/10/
Something to bear in mind, since you have a specific page size you'd like to target, in print you can always specify the dimensions in millimetres:
@media print {
.container {
display: flex;
flex-direction: column;
height: 297mm;
flex-wrap: wrap;
}
.container div {
box-sizing: border-box;
height: 99mm;
width: 70mm;
border: 1px solid red;
}
}
Again, this is pseudo code - in reality, you'll want to account for headers and footers and margins, but this should provide a good starting point.
Here's an example that works on screen, and should work in print:
body { margin: 0 }
@media screen {
.container {
display: flex;
flex-direction: column;
height: 100vh;
flex-wrap: wrap;
}
.container div {
box-sizing: border-box;
height: 33.3vh;
border: 1px solid red;
}
}
@media print {
.container {
display: flex;
flex-direction: column;
height: 100vh;
flex-wrap: wrap;
}
.container div {
box-sizing: border-box;
height: 33.3vh;
border: 1px solid red;
}
}
<div class="container">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
</div>
Note I have not used your code in order to keep the mechanics clear. See it working here:
http://jsfiddle.net/tobyl/bec6sryf/10/
Something to bear in mind, since you have a specific page size you'd like to target, in print you can always specify the dimensions in millimetres:
@media print {
.container {
display: flex;
flex-direction: column;
height: 297mm;
flex-wrap: wrap;
}
.container div {
box-sizing: border-box;
height: 99mm;
width: 70mm;
border: 1px solid red;
}
}
Again, this is pseudo code - in reality, you'll want to account for headers and footers and margins, but this should provide a good starting point.
body { margin: 0 }
@media screen {
.container {
display: flex;
flex-direction: column;
height: 100vh;
flex-wrap: wrap;
}
.container div {
box-sizing: border-box;
height: 33.3vh;
border: 1px solid red;
}
}
@media print {
.container {
display: flex;
flex-direction: column;
height: 100vh;
flex-wrap: wrap;
}
.container div {
box-sizing: border-box;
height: 33.3vh;
border: 1px solid red;
}
}
<div class="container">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
</div>
body { margin: 0 }
@media screen {
.container {
display: flex;
flex-direction: column;
height: 100vh;
flex-wrap: wrap;
}
.container div {
box-sizing: border-box;
height: 33.3vh;
border: 1px solid red;
}
}
@media print {
.container {
display: flex;
flex-direction: column;
height: 100vh;
flex-wrap: wrap;
}
.container div {
box-sizing: border-box;
height: 33.3vh;
border: 1px solid red;
}
}
<div class="container">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
</div>
answered Dec 28 '18 at 1:50
Toby
5,12242146
5,12242146
Thank you very much for a much cleaner solution. However, this causes the content to overflow the page to the right and not be included in the print.
– apocs
Dec 28 '18 at 9:59
As noted at the bottom of my answer, you'll need to adjust sizing to account for margins.
– Toby
Dec 28 '18 at 12:59
add a comment |
Thank you very much for a much cleaner solution. However, this causes the content to overflow the page to the right and not be included in the print.
– apocs
Dec 28 '18 at 9:59
As noted at the bottom of my answer, you'll need to adjust sizing to account for margins.
– Toby
Dec 28 '18 at 12:59
Thank you very much for a much cleaner solution. However, this causes the content to overflow the page to the right and not be included in the print.
– apocs
Dec 28 '18 at 9:59
Thank you very much for a much cleaner solution. However, this causes the content to overflow the page to the right and not be included in the print.
– apocs
Dec 28 '18 at 9:59
As noted at the bottom of my answer, you'll need to adjust sizing to account for margins.
– Toby
Dec 28 '18 at 12:59
As noted at the bottom of my answer, you'll need to adjust sizing to account for margins.
– Toby
Dec 28 '18 at 12:59
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53952446%2flisting-x-divs-for-print-on-a4-paper%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What is the CSS you've tried, any what isn't working? Also, you'll need to post your HTML.
– Toby
Dec 28 '18 at 0:43