Skip to content

Instantly share code, notes, and snippets.

@julien-gargot
Last active March 30, 2017 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julien-gargot/17b3d16a5fa1d9d2321d17acc9a216ec to your computer and use it in GitHub Desktop.
Save julien-gargot/17b3d16a5fa1d9d2321d17acc9a216ec to your computer and use it in GitHub Desktop.
Create “print” design from your browser. (Pantoufle basic structure.)
/* =Pantoufle
* v0.2.3
* ---------------------------------------------------------------------------*/
.hide {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}
.page {
position: relative;
float: left;
width: 210mm;
height: 297mm;
overflow: hidden;
}
.page .content {
position: static !important;
overflow: hidden;
width: calc(100% - 40mm);
height: calc(100% - 40mm);
margin-top: 20mm;
margin-bottom: 20mm;
}
.page#cover .content {
width: calc(100% - 40mm);
height: calc(100% - 40mm);
margin-top: 20mm;
margin-right: 20mm;
margin-bottom: 20mm;
margin-left: 20mm;
}
.page.page-default:nth-of-type(odd) .content {
margin-left: 20mm;
margin-right: 20mm;
}
.page.page-default:nth-of-type(even) .content {
margin-left: 20mm;
margin-right: 20mm;
}
/* =Screen
*/
@media screen {
*,
*::after,
*::before {
box-sizing: border-box;
}
html {
height: 100%;
width: 100%;
margin: 0;
}
body {
margin: 0;
min-width: 450mm;
background-color: #606060;
}
body.preview {
background-color: #bababa;
}
.page {
margin-top: 1cm;
background-color: #fff;
box-shadow: 2px 2px 0px 1px #000, 0px 0px 0px 1px #000;
}
.page:last-child {
margin-bottom: 1cm;
}
.page:before {
content: "";
display: block;
position: absolute;
z-index: 2;
top: 20mm;
bottom: 20mm;
border: 1px solid;
border-color: #60c600 #738a5e;
pointer-events: none;
}
.page#cover {
margin-right: 1cm;
margin-left: 220mm;
}
.page#cover:before {
top: 20mm;
right: 20mm;
bottom: 20mm;
left: 20mm;
}
.page.page-default:nth-of-type(odd) {
margin-left: 1cm;
}
.page.page-default:nth-of-type(even) {
margin-right: 1cm;
}
.page.page-default:nth-of-type(odd):before {
left: 20mm;
right: 20mm;
}
.page.page-default:nth-of-type(even):before {
left: 20mm;
right: 20mm;
}
}
/* =Print
*/
@media print {
*,
*::after,
*::before {
box-sizing: border-box;
}
@page {
size: landscape;
margin: 0mm;
}
html,
body {
background-color: transparent;
margin: 0;
}
.page {
width: 50vw;
height: 100vh;
}
}
@media screen {
body {
-ms-transform-origin: top left;
transform-origin: top left;
-ms-transform: scale(0.25);
transform: scale(0.25);
}
}
/* =Theme
* Start your theme here.
* ---------------------------------------------------------------------------*/
<!-- start page -->
<section class="page page-default">
<div class="content">
<!-- Content -->
</div>
</section>
<!-- end page -->
name: Pantoufle basic structure
description: Create “print” design from your browser.
authors:
- Julien Gargot
resources:
- https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
normalize_css: no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment