CSS reorganization and print style updates
authorclinton <clinton@unknownlamer.org>
Thu, 29 Jan 2009 08:19:25 +0000 (08:19 +0000)
committerclinton <clinton@unknownlamer.org>
Thu, 29 Jan 2009 08:19:25 +0000 (08:19 +0000)
* muse <src> blocks now use the emacs face name as the CSS class of
  marked up regions
* Printed code is now acceptably readable and marked up to look
  tolerable when printed by my laserjet
* Reorganized the CSS rules to make things a bit easier to
  read...
* Lightened a few box backgrounds when printing
* Reduced or removed borders on all boxes when printing
* Moved the contents box to the left side of the page when printing
* Added pagination hints that result in much nicer printed output when
  using a WebKit or KHTML based browser. Alas, Mozilla still has no
  support for such things and tends to place headings at the bottom of
  pages and other horrible things.
* Cap the width of images when printing to prevent weird scaling and
  clipping issues

default.css

index 9621794..c50dad4 100644 (file)
@@ -4,6 +4,16 @@ body
   font-family: serif;
 }
 
+p
+{ 
+  text-align: justify;
+}
+
+h1,h2,h3,h4,h5
+{ 
+  font-variant: small-caps;
+}
+
 @media screen
 { 
   body
@@ -20,52 +30,31 @@ body
   {
     font-size: 10pt;
   }
-}
 
-.verse, .src, .image, blockquote
-{
-  clear: right; /* Clear the contents box usually */
-}
-
-.src
-{ 
-  margin-right: auto;
-  margin-left: auto;
-  width: 95%;
-  border: 2px solid black;
-  padding: 1em;
-
-  white-space: pre-wrap;       /* css-3 */
-  white-space: -moz-pre-wrap;  /* Mozilla */
-}
+  dd, table, blockquote, code, .verse, .src, .image
+  { 
+    page-break-inside: avoid;
+  }
 
-@media screen
-{ 
-  .src
-  {
-    color: #e3e3e3;
-    background-color: #444444;
+  h1, h2, h3, h4, h5
+  { 
+    page-break-before: auto;
+    page-break-after: avoid;
   }
-}
 
-@media print
-{ 
-  .src
-  {
-    color: #535353;
-    background-color: #888888;
+  h1 + p, h2 + p, h3 + p, h4 + p, h5 + p
+  { 
+    page-break-before: avoid;
+    page-break-after: auto;
   }
-}
 
-p
-{ 
-  text-align: justify;
+  @page
+  { padding: 0.1in; margin: 1in 1.25in; }
 }
 
 .verse
 {
   padding: 1em;
-  border: 2px solid #999999;
   width: 60%;
   margin-right: auto;
   margin-left: auto;
@@ -76,6 +65,7 @@ p
 { 
   .verse
   {
+    border: 2px solid #999999;
     background-color: #BBBBBB;
     color: #111111;
   }
@@ -84,7 +74,6 @@ p
 blockquote
 { 
   padding: 1em;
-  border: 2px solid black;
   width: 80%;
   margin-right: auto;
   margin-left: auto;
@@ -94,6 +83,7 @@ blockquote
 { 
   blockquote
   {
+    border: 2px solid black;
     background-color: #AAAAAA;
     color: #111111;
   }
@@ -151,21 +141,13 @@ a:visited
   }
 }
 
-h1,h2,h3,h4,h5
-{ 
-  font-variant: small-caps;
-}
-
 /* Table of Contents */
 div.contents
 { 
   border: 2px solid #222222;
-  background-color: #999999;
   width: 40%;
   padding: 0.5em;
-  margin-left: 2em;
   margin-bottom: 1em;
-  float: right;
 }
 
 div.contents:before
@@ -179,25 +161,77 @@ div.contents:before
 /* control spacing of contents in konqueror */
 div.contents dl
 { 
-  margin-top: 0.2em;
-  margin-bottom: 0.2em;
+  margin: 0.2em auto;
+}
+
+div.contents dl, div.contents dt
+{ 
+  margin-left: 0px;
+}
+
+div.contents dd
+{
+  margin-left: 1.5em;
+}
+
+@media screen
+{ 
+  div.contents
+  {
+    background-color: #999999;
+    margin-left: 2em;
+    float: right;
+  }
+
+  .verse, .src, .image, blockquote
+  {
+    clear: right; /* Clear the contents box  */
+  }
 }
 
 @media print
 { 
   div.contents
   {
-    background-color: #CCCCCC;
+    background-color: #DFDFDF;
+    border-width: 0.05mm;
+    float: left;
+    margin-right: 2em;
   }
 
+ .verse, .src, .image, blockquote
+  {
+    clear: left; /* Clear the contents box  */
+  } 
+
   div.contents dt
   {
     font-size: 6pt;
+    page-break-after: avoid;
+  }
+
+  div.contents > dd
+  { 
+    page-break-inside: auto;
+  }
+
+  div.contents > dd > dl
+  { 
+    page-break-inside: avoid;
+    page-break-before: auto;
+    page-break-after: auto;
+  }
+
+  div.contents > dd > dl dl
+  { 
+    page-break-inside: avoid;
+    page-break-before: avoid;
+    page-break-after: avoid;
   }
 }
 
 /* Images */
-table.image, p.image
+.image
 { 
   border: 2px solid #222222;
   width: auto;
@@ -206,24 +240,8 @@ table.image, p.image
   margin-right: auto;
 }
 
-@media screen
-{ 
-  table.image, p.image
-  {
-    background-color: #999999;
-  }
-}
-
-@media print
-{ 
-  table.image, p.image
-  {
-    background-color: #CCCCCC;
-  }
-}
-
 /* Force spacing between image boxes */
-table.image + table.image, p.image + p.image
+.image + .image
 {
   margin-top: 1em;
 }
@@ -238,6 +256,33 @@ table.image tr td.image-caption
   font-style: italic;
 }
 
+@media screen
+{ 
+  .image
+  {
+    background-color: #999999;
+  }
+}
+
+@media print
+{ 
+  .image
+  {
+    background-color: #CCCCCC;
+    border-width: 0.05mm;
+    page-break-inside: avoid;
+    page-break-after: auto;
+    page-break-before: auto;
+  }
+
+  .image img
+  {
+    max-width: 80%;
+    page-break-inside: avoid;
+    page-break-after: auto;
+  }
+}
+
 img.latex-display
 { 
   display: block;
@@ -308,4 +353,74 @@ p.cke-buttons img
   {
     display: none;
   }
+}
+
+.src
+{ 
+  font-family: monospace;
+  margin-right: auto;
+  margin-left: auto;
+  width: 95%;
+  border: 2px solid black;
+  padding: 1em;
+
+  white-space: pre-wrap;       /* css-3 */
+  white-space: -moz-pre-wrap;  /* Mozilla */
+}
+
+@media screen
+{ 
+  .src
+  {
+    color: #e3e3e3;
+    background-color: #444444;
+  }
+}
+
+@media print
+{ 
+  .src
+  {
+    color: #000000;
+    background-color: #F5F5F5;
+    border-width: 0.05mm;
+    font-size: 8pt;
+  }
+}
+
+/* emacs faces */
+@media screen
+{ 
+  .emacs-face-builtin { color: #b0c4de; }
+  .emacs-face-comment { color: #ff7f24;  }
+  .emacs-face-comment-delimiter { color: #ff7f24; }
+  .emacs-face-doc { color: #b3b3b3; }
+  .emacs-face-function-name { color: #87cefa; }
+  .emacs-face-keyword { color: #b9d3ee; }
+  .emacs-face-negation-char { }
+  .emacs-face-regexp-grouping-backslash { font-weight: bold;  }
+  .emacs-face-regexp-grouping-construct { font-weight: bold; }
+  .emacs-face-string { color: #b3b3b3; }
+  .emacs-face-type { color: #98fb98; }
+  .emacs-face-variable-name { color: #eedd82; }
+  .emacs-face-warning { color: #ffc0cb;
+                        font-weight: bold; }
+}
+
+@media print
+{ 
+  .emacs-face-builtin { color: #0b4ced; }
+  .emacs-face-comment { color: #ff7f24; font-style: italic; }
+  .emacs-face-comment-delimiter { color: #ff7f24; }
+  .emacs-face-doc { color: #5b5b5b; }
+  .emacs-face-function-name { color: #34a8aa; font-style: italic; }
+  .emacs-face-keyword { color: #0B0B0B; font-weight: bold; }
+  .emacs-face-negation-char { }
+  .emacs-face-regexp-grouping-backslash { font-weight: bold;  }
+  .emacs-face-regexp-grouping-construct { font-weight: bold; }
+  .emacs-face-string { color: #3b3b3b; font-style: italic; }
+  .emacs-face-type { color: #579b57; font-variant: small-caps; }
+  .emacs-face-variable-name { color: #554406; font-style: italic; }
+  .emacs-face-warning { color: #990767;
+                        font-weight: bold; }
 }
\ No newline at end of file