Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

A stylesheet for the Emacs Org Mode HTML export

View org-style.css
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
/**
* This stylesheet will work pretty well with a regular Org Mode HTML export.
* However, you do have to turn off all of the defaults:
*
* (setq org-export-html-style-include-scripts nil
* org-export-html-style-include-default nil)
*
* and insert a call to the stylesheet:
*
* (setq org-export-html-style
* "<link rel=\"stylesheet\" type=\"text/css\" href=\"org-style.css\" />")
*/
 
/* @group Fonts */
 
* {
font-family: "Georgia";
}
 
h1, h2, h3, h4, h5, h6,
h1 span, h2 span, h3 span, h4 span, h5 span, h6 span,
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
font-family: "Arial";
}
 
pre {
font-family: Monaco, "Courier New", Courier;
}
 
#text-table-of-contents a {
font-family: "Arial";
}
 
/* @end */
 
/* @group Baseline */
body {
font-size: 14px;
line-height: 1.5em;
padding: 0;
margin: 0;
}
h1 {
margin: 0;
font-size: 1.6666666666666667em;
line-height: 0.9em;
margin-bottom: 0.9em;
}
h2 {
margin: 0;
font-size: 1.5em;
line-height: 1em;
margin-bottom: 1em;
}
h3 {
margin: 0;
font-size: 1.3333333333333333em;
line-height: 1.125em;
margin-bottom: 1.125em;
}
h4 {
margin: 0;
font-size: 1.1666666666666667em;
line-height: 1.2857142857142858em;
margin-bottom: 1.2857142857142858em;
}
p, ul, blockquote, pre, td, th, label {
margin: 0;
font-size: 1em;
line-height: 1.5em;
margin-bottom: 1.5em;
}
p.small, #postamble {
margin: 0;
font-size: 0.8333333333333334em;
line-height: 1.8em;
margin-bottom: 1.8em;
}
table {
border-collapse: collapse;
margin-bottom: 1.5em;
}
/* @end */
 
/* @group Layout */
 
#content {
width: 70em;
margin-left: auto;
margin-right: auto;
}
 
/* #header {
height: 10em;
}
*/
 
#table-of-contents {
width: 15em;
float: left;
overflow: auto;
}
 
/* #main { */
div.outline-2 {
width: 52em;
float: right;
/* The lines below are useful if the "main" div isn't available and
div.outline-2 has to be used. */
position: relative;
}
 
#postamble {
clear: both;
text-align: center;
}
 
div.outline-2 pre {
width: 40em;
overflow: auto;
}
 
/* @end */
 
/* @group Header */
 
h1.title {
margin-top: 10px;
text-align: center;
}
 
h1.title {
font-size: 4em;
font-weight: bold;
letter-spacing: -0.1em;
margin-bottom: 0.2em;
}
 
/* @end */
 
/* @group Org Keywords */
 
.todo {
color: red;
}
 
.done {
color: green;
}
 
.tag {
color: blue;
text-transform: lowercase;
/* This will be obscured by the surrounding span tag, so blank everything. */
background: #fff;
border: none;
/* position: relative;
text-align: right;
right: 1em; */
}
 
.timestamp {
}
 
.timestamp-kwd {
/* keyword associated with a time stamp, like SCHEDULED */
}
 
.target {
/* target for links */
}
 
/* @end */
 
/* @group Table of Contents */
 
#table-of-contents h2 {
letter-spacing: -0.1em;
}
 
#table-of-contents ul,
#table-of-contents ol {
padding-left: 1em;
}
 
/* @end */
 
/* @group Outline Level 2 */
 
.outline-2 h2 {
background: #ffc;
border-bottom: 1px solid #ccc;
}
 
.outline-2 h2, .outline-2 h3 {
letter-spacing: -0.05em;
}
 
.outline-2 {
padding: 5px;
/* margin-bottom: 10px; */
/* border-top: 1px solid #ccc; */
}
 
/* @end */
 
td {
border: 1px solid #ccc;
}
 
 
h1 span, h2 span, h3 span, h4 span, h5 span, h6 span {
background-color: #eee;
padding: 2px;
border: 1px solid #ccc;
}
 
.outline-1, .outline-2, .outline-3, .outline-4, .outline-5, .outline-6 {
margin-left: 2em;
}
 
a {
text-decoration: none;
color: #57d; /* TODO: Find a better colour for this. */
}
 
a:hover {
border-bottom: 1px dotted #57d;
}
 
#postamble p {
margin: 0px;
}

I am think if it is possible to emebed this css file to the html file generated, how to do that?

Owner
mowen commented

I preferred not to embed it, but you could escape all of the quotes and put it in a string within a tag and set the org-export-html-style variable to it. It may be out of date now as it was written a long time ago and I don&#39;t know if the markup has changed.</p>

Somewhere in your Emacs init file (probably .emacs in your home directory) you need to add the following code:

(setq org-export-html-style "<style>
pre.src { background-color: #ccc; }
</style>")

Where your full CSS is within the style tags. You will have to replace any quotes '"' with '\"' so that they don't close the string.

The next time you export to HTML the CSS should be embedded.

The documentation of the classes in the HTML and ways to add the CSS is in the documentation here: http://orgmode.org/manual/CSS-support.html#CSS-support

If you've still having problems could you post your CSS in a Gist and I will give you the code that you need to add to your Emacs init file to make it work.

Thanks for your help, finally I make it work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.