youbbs avatar

适配kindle 阅读器的css 样式

🕦 by youbbs

Supported HTML and CSS for the Amazon Kindle

http://kindleformatting.com/book/files/KindleHTMLtags.pdf

Kindle Stylesheet

http://bbebooksthailand.com/bb-CSS-boilerplate.html

CSS: Kindle Stylesheet
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
/* BB eBooks BoilerPlate Kindle for MOBI 7 and KF8*/
/* Modify as Needed */
/* visit us @ http://bbebooksthailand.com/developers.html */

/*===Reset Code===*/
html, body, div, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, center, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video
{
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
vertical-align: baseline;
}

/* Do Not reset ol, ul, or table for MOBI 7. It blows out all styling */

/*===GENERAL PRESENTATION===*/
/*===Body Presentation and Margins===*/
body
{
text-align: justify;
line-height: 120%;
}

/*===Headings===*/
/* After page breaks, Kindle does not render margins above the content unless there is a file split in the package. */
h1
{
text-indent: 0;
text-align: center;
margin: 100px 0 0 0;
font-size: 2.0em;
font-weight: bold;
page-break-before: always;
}

h2
{
text-indent: 0;
text-align: center;
margin: 50px 0 0 0;
font-size: 1.5em;
font-weight: bold;
page-break-before: always;
}

h3
{
text-indent: 0;
text-align: left;
font-size: 1.4em;
font-weight: bold;
}

h4
{
text-indent: 0;
text-align: left;
font-size: 1.2em;
font-weight: bold;
}

h5
{
text-indent: 0;
text-align: left;
font-size: 1.1em;
font-weight: bold;
}

h6
{
text-indent: 0;
text-align: left;
font-size: 1.0em;
font-weight: bold;
}


/*===Paragraph Elements===*/
/* Margins are usually added on the top, left, and right, but not on the bottom to prevent Kindle not collapsing white space properly */

/*firstline indent for fiction*/
p
{
text-indent: 1.25em;
margin: 0;
}

/*block indent for non-fiction*/
/*
p
{
text-indent: 0;
margin: 1.0em 0 0 0;
}
*/

/* for centered text and element wrappers on images*/
p.centered
{
text-indent: 0;
margin: 1.0em 0 0 0;
text-align: center;
}

/* section Breaks (can use centered-style for non-fiction) */
p.centeredbreak
{
text-indent: 0;
margin: 1.0em 0 1.0em 0;
text-align: center;
}

/* First sentence in chapters following heading */
p.texttop
{
margin: 1.5em 0 0 0;
text-indent: 0;
}

/* 1st level TOC */
p.toctext
{
margin: 0 0 0 1.5em;
text-indent: 0;
text-align: left;
}

/* 2nd level TOC */
p.toctext2
{
margin: 0 0 0 2.5em;
text-indent: 0;
text-align: left;
}

/*==IMAGES==*/


/*===IN-LINE STYLES===*/
span.i
{
font-style: italic;
}

span.b
{
font-weight: bold;
}

span.u
{
text-decoration: underline;
}

span.st
{
text-decoration: line-through;
}

/*==in-line combinations==*/
/* Using something like <span class="i b">... may seem okay, but it causes problems on the Kindle */
span.ib
{
font-style: italic;
font-weight: bold;
}

span.iu
{
font-style: italic;
text-decoration: underline;
}

span.bu
{
font-weight: bold;
text-decoration: underline;
}

span.ibu
{
font-style: italic;
font-weight: bold;
text-decoration: underline;
}


/* Superscripted Footnote Text */
.footnote
{
vertical-align: super;
font-size: 0.75em;
text-decoration: none;
}


/*==KF8 specific here ==*/

@media amzn-kf8{ 

span.dropcap {
font-size: 300%;
font-weight: bold;
height: 1em;
float: left;
margin: -0.2em 0.1em 0 0.1em;
}

p.clearit
{
clear: both;
}

ol, ul, li, dl, dt, dd 
{
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
vertical-align: baseline;
}

/*==Lists ==*/
ul
{
margin: 1em 0 0 2em;
text-align: left;
}

ol
{
margin: 1em 0 0 2em;
text-align: left;
}

table
{
border-collapse: collapse;
border-spacing: 0;
margin: 1.0em auto;
}

tr, th, td
{
margin: 0;
padding: 2px;
border: 1px solid black;
font-size: 100%;
vertical-align: baseline;
}

} /* End KF8 Specific Styles */

/*==e-ink Kindle Specific==*/
@media amzn-mobi{

/* pseudo dropcaps for e-ink Kindles */
span.dropcap {
font-size: 1.5em;
font-weight: bold;
}

} /* End e-ink Kindle Specific Styles */

/*==eBook Specific Formatting Below Here==*/

💘 相关文章

写一条评论

Based on Golang + fastHTTP + sdb | go1.17.6 Processed in 1ms