33.1 CSS rules

The layout follows simple CSS rules. On opening both EPUB and HTML documents CSS rules are read from a series of locations in defined order.

Firstly, an inbuilt set of CSS (see html_default_css) is read for all files with the exception of those identified as FictionBook 2 format which have their own special case rules (see fb2_default_css).

Next, the CSS rules from the document itself are read. If you would rather avoid this, it can be suppressed using:

/* 
   fz_set_use_document_css: Toggle whether to respect document styles in HTML and EPUB. 
*/ 
void fz_set_use_document_css(fz_context *ctx, int use);

Finally a set of ‘user’ CSS is read. This defaults to empty, but can be supplied using:

/* 
   fz_set_user_css: Set the user stylesheet source text for use with HTML and EPUB. 
*/ 
void fz_set_user_css(fz_context *ctx, const char *text);

Thus the user CSS is the last to be read and can potentially override all the settings made by the defaults and document CSS.