7 votes

Any opensource or free css stylesheets for books?

Paul Salvette wrote an ebook formatting guide which I recommend. He wrote boilerplate css which you can view/download here: http://bbebooksthailand.com/bb-CSS-boilerplate.html His company has ...
idiotprogrammer's user avatar
4 votes
Accepted

How to alternate row colors of tables in ePub files

You can use the following CSS rules to style respectively even or odd table rows (See the Example on W3schools): tr:nth-child(even) { background-color: #f2f2f2 } tr:nth-child(odd) { ...
Sekhemty's user avatar
  • 6,194
3 votes

How to set the font sizes of two text sections to be relative to each other?

I eventually found out that I can use style="font-size:90%;" which is not exactly what I wanted but is sufficients for my needs.
mau's user avatar
  • 2,364
3 votes

How can I prevent a widowed/orphaned header?

I would use h4 {page-break-after: avoid;} p { widows: 2; orphans: 2; } I think this works for Kindles as well as epubs. This is just example code. My guess is that this is structured content ...
idiotprogrammer's user avatar
3 votes
Accepted

How can I prevent a widowed/orphaned header?

According to this blog article, you should use the display: inline-block property on a div selector that encloses your header and paragraph. Here is an excerpt from the said article: If you set ...
Sekhemty's user avatar
  • 6,194
3 votes
Accepted

Media queries to distinguish between Kindle e-inks vs non-e-inks

The preferred solution (and the one I use) is to create default css outside of the media query breakpoints, and then this css will apply to e-ink devices (which don't support media queries -- even the ...
idiotprogrammer's user avatar
3 votes

Moon+ Reader -- what kind of CSS support? formatting tips?

There is now a setting in MoonReader to disable publisher's CSS. But even when it's not checked, not all CSS is supported. I've tested multiple Android Epub readers with a bilingual epub I made, where ...
Suzana's user avatar
  • 131
3 votes
Accepted

Calibre ebook viewer - Apply User Stylesheet to Full Screen Mode

Paste the following in the 'User stylesheet', click ok. Then go to 'Theming' and save the style with whatever name you like. The e-book will display nicely in any screen mode and there are a couple of ...
michael biller's user avatar
3 votes
Accepted

Can I split chapters with CSS?

It can be accomplished with the page-break-after (link) or page-break-before (link) CSS properties. Pretty obviously, these create a page break after or before the element that they are applied on. ...
Sekhemty's user avatar
  • 6,194
2 votes

Is it possible to create anchors in the numbers of an <ol> list?

Earlier in text: <a name="header1">Header 1</a> <a name="header2">Header 2</a> further down... <ol> <li><a href="#header1">item one</a></li> &...
Bulrush's user avatar
  • 367
2 votes
Accepted

Should every paragraph tag have a CSS style (InDesign)?

There is no need to give every paragraph a class, the definition at 1. will apply to every paragraph, with or without a tag, and only on paragraphs that are directly below a footnote the settings ...
Anthon's user avatar
  • 7,641
2 votes
Accepted

Is it more effective to apply CSS styles to <p> or <body> elements in an ePub?

If you set properties for <body>, it will affect even elements like headers (<h1>...<h6>), lists (<ul>, <li>), and everything else, not just regular paragraphs (<p>)...
Sekhemty's user avatar
  • 6,194
2 votes

Publishing in serveral formats: what CSS code to use?

First, it's important to keep in mind that css support on ebooks significantly lags behind css support on the major browsers. EPUB only supports a subset of css. Among the many challenges of ...
idiotprogrammer's user avatar
2 votes

Problem with left alignment in Calibre/iBooks

I don't think text-align left and Justify text have anything to do with one another. Justification is usually controlled by the reading system, while text-align left is the default behavior for text. ...
idiotprogrammer's user avatar
1 vote

Is it possible to set font-color to the background-color

Let's analyze this question a little bit. The 7; is it a background image or using some advanced css trick like this? https://stackoverflow.com/questions/15986216/how-can-i-add-a-large-faded-text-...
idiotprogrammer's user avatar
1 vote

Alternate covers for different devices and software

Generally the answer is no. You are defining only one cover in your source -- but you can easily test how it renders in both color and greyscale. So it should be high contrast and not so much color-...
idiotprogrammer's user avatar
1 vote
Accepted

which readers honor -webkit-transform CSS property?

I guess the problem is either: in the specific software (Moon + Reader Pro): maybe it has some bugs in parsing .css or in the screen size of your tablet: the scale 0.25 is too big for it The css ...
olha's user avatar
  • 128
1 vote

css - select only when followed by specific element

Okay, I kind of found an answer (for this case at least) myself. The key was to walk away from the margin-bottom and look at it the other way around. So first deleting the margin-bottom from p.line ...
SabineR's user avatar
  • 131
1 vote

css - select only when followed by specific element

As you've discovered, the challenges here are that: in CSS, it's not possible to select a parent or ancestor element by its child; the browser applies CSS 'downwards' only; and you can't know what ...
Arthur's user avatar
  • 361
1 vote
Accepted

Keeping a subheading with its first line of text in an epub

page-break-after: avoid should work, if the reading system supports it.
thinkulum's user avatar
  • 416
1 vote

Move image to top of the page (like LaTeX’s \begin{figure}[t])

My guess is no. You want the img (or the div container) to be a block element. At the same time, you want the image to act like an inline element -- adjusting to the display. A block element by ...
idiotprogrammer's user avatar
1 vote
Accepted

CSS: Spans vs Font Families

Before looking at anything, you might want to look on the available fonts for each device. What are serif and sans serif fonts on different ebook reading systems? It doesn't show iBooks as having ...
idiotprogrammer's user avatar
1 vote
Accepted

Can you use CSS to target iOS night reading mode?

I found the answer to this on stackoverflow. You can target different iBooks reading modes using these special CSS selectors: :root[__ibooks_internal_theme*="Sepia"] :root[__ibooks_internal_theme*="...
blendenzo's user avatar
  • 296
1 vote

Adding Video links to an ebook

I'm in the process of writing a bi-lingual multi-column translation of an Adobe.pdf German book on some of the regional dialects in Germany. I have successfully tested .pdf pages that have test links ...
К. Келлогг Смиф's user avatar
1 vote

How can I highlight visited anchors in an epub?

You can use these CSS styling for links. /* unvisited link */ a:link { color: green; } /* visited link */ a:visited { color:red; } /* mouse over link */ a:hover { color: blue; } /* selected link *...
Leon William's user avatar
1 vote
Accepted

How can I highlight visited anchors in an epub?

You can use a couple CSS selectors to style links. a:link will select and style all unvisited links, while a:visited, surprisingly enough, will do the same with visited ones. Examples: a:link { ...
Sekhemty's user avatar
  • 6,194
1 vote

How to alternate row colors of tables in ePub files

In HTML just set the fill colours on each row to alternating values some authoring software probably has a table style that does this for you but off the top of my head I can't say which. MS-Word used ...
Steve Barnes's user avatar
1 vote
Accepted

Overriding Device Styles

Every device works in a different way, I don't think that there are standards regarding the programming of the software that they are equipped with. Besides that, almost every e-reading device and ...
Sekhemty's user avatar
  • 6,194
1 vote
Accepted

Table headings that may repeat for several "pages"

Great question. First, you should be making epub3 files because generally epub3 files work on epub2 reading systems. All epub2 readers can view epub3 files -- though perhaps not optimally. My ...
idiotprogrammer's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible