Suggestion for "kobo_extra.css": Option to place rules before or behind other rules

Bug #1224937 reported by Peter on 2013-09-13
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Undecided
David Forrester

Bug Description

At the moment, the rules of "kobo_extra.css" are placed behind the rules of the embedded stylesheet.

May be some users like to use the rules in "kobo_extra.css" as generic rules for all their books, and the rules in the embedded stylesheet as specific rules, only for the specific book.

Example:

default.css:
h1 { font-size: 2em }

kobo_extra.css
h1 { font-size: 1em }

The rule of kobo_extra.css wins, because it is listed behind the rule of default.css.

The only way for the user to let the rule win about kobo_extra.css is to embedd another stylesheet or an internal rule set via "<style></style>" behind the
<link href="../Styles/default.css" rel="stylesheet" type="text/css"/>

My suggestion/wish:
An option where to add the rules of kobo_extra.css:

at the top
at the bottom

May be you like my suggestion?
Thanks for all your work and for offering the great plugin! :)

Joel Goguen (jgoguen) wrote :

That would be entirely David's domain, he's got the code that does the manipulation. I'll fire this over to the calibre project and try really hard to assign him :)

Changed in calibre-kobo-driver:
assignee: nobody → David Forrester (davidfor)
affects: calibre-kobo-driver → calibre
Peter (lepf) wrote :

Thanks Joel :)

David Forrester (davidfor) wrote :

That is an interesting idea. I'm not sure how much benefit it would give. From what I have seen of most stylesheets in purchased books, nothing from styles added at the start would survive. Adding to the end guarantees the styles are used. And it achieves what I think most people want.

A hassle I have with is is that it needs another option. I hesitate to add them as they just keep multiplying. Another problem is that the obvious next suggestion is to add to both the start and end of the stylesheet. I suppose that wouldn't be that hard, but it complicates things.

I'll consider it, especially if others are interested.

Peter (lepf) wrote :

Thanks David for considering the idea.

In a nice world the problem of the cascade could easily solved by using "!important".

The userstyles are just placed at the top of the rules of the embedded stylesheet.

If they end with "!important" they win.
If not, it depends.

I made a test with my eReader Kobo Glo. It fails, when a stylesheet contains "!important".
I don't know how other software reacts.

I understand, that you hesitate to add two new option. But I have no other idea how to offer that functionality in another way.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers