Skip to content

Instantly share code, notes, and snippets.

@nournia
Last active December 21, 2015 16:29
Show Gist options
  • Save nournia/6333872 to your computer and use it in GitHub Desktop.
Save nournia/6333872 to your computer and use it in GitHub Desktop.
Template for printing Persian document.
<meta charset="utf-8" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(function() {
$('img').wrap('<div class="figure"></div>').parent().parent().addClass('container').each(function() {
$(this).find('img').after('<span class="title">'+ $(this).find('img').attr('alt') +'</span>');
});
})
</script>
<style type="text/css">
body {
direction: rtl;
padding: 0;
margin: 0 40px;
}
body, table, p {
font-family: B Mitra;
font-size: 20px;
}
p {
margin-top: 0;
margin-bottom: 10px;
text-align: justify;
line-height: 28px;
}
h1, h2, h3 {
font-family: B Yekan;
}
h1 {
font-size: 1.4em;
margin-top: 20px;
margin-bottom: 10px;
}
h2 {
font-size: 1.2em;
margin-top: 10px;
margin-bottom: 4px;
}
h3 {
font-size: 1em;
margin-top: 6px;
margin-bottom: 2px;
}
hr {
visibility: hidden;
page-break-before: always;
}
blockquote {
page-break-inside: avoid;
padding: 2px 10px 2px 0;
margin: 20px 0 10px 0;
border: none;
border-right: 5px solid #eee;
}
blockquote p {
margin: 0;
line-height: 24px;
}
strong, th {
font-size: .85em;
}
code {
font-family: serif;
border-bottom: 2px solid #ccc;
}
table {
border-spacing: 0;
}
table, img {
text-align: center;
margin: 0 auto 25px;
display: block;
}
img {
border: 2px solid #ccc;
max-width: 100%;
}
.container {
page-break-inside: avoid;
text-align: center;
margin: 0;
margin-bottom: 20px;
}
.container .title {
margin-top: -25px;
font-size: .9em;
display: inline-block;
float: left;
padding: 2px 5px 0;
}
.figure {
display: inline-block;
}
/* table */
tbody {
border-top: 2px solid #ddd;
}
th, td {
padding: 8px;
line-height: 20px;
}
th {
border-bottom: 2px solid #ddd;
}
td {
border-bottom: 1px solid #ddd;
}
td:first-child {
border-top: 0;
}
tr:last-child td {
border-bottom: none;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment