epub.js icon indicating copy to clipboard operation
epub.js copied to clipboard

Removing vertical padding from paginated view in v0.3

Open pgaskin opened this issue 7 years ago • 11 comments

I'm planning to manage the vertical padding myself in my updated reader, but here, epub.js sets it to 20px. Nothing breaks when I set it to 0px, which makes me think it is unnecessary (and it was not there in v0.2).

To override it, I currently need to do some hacky stuff by setting an interval to constantly set the padding to 0 until it stays the same.

Personally, I would fix this by setting the horizontal padding (needed for pagination) separately from the vertical padding. Then, I would make only the horizontal padding !important so the vertical padding can be overrided the usual way (with contents.css).

pgaskin avatar May 16 '18 00:05 pgaskin

That all makes sense to me.

However I am thinking of moving that default padding to the default theme, so it's easier to override but still present unless you want to change it.

fchasen avatar May 17 '18 23:05 fchasen

OK, that sounds good. For now, I've modified my version to get rid of the vertical padding.

pgaskin avatar May 18 '18 16:05 pgaskin

@fchasen Is there is an example for this?

bleedweedsuz avatar Jul 25 '18 10:07 bleedweedsuz

You can define padding in a theme like:

rendition.themes.default({
    "body": { "padding-top": "10px" }
})

fchasen avatar Jul 25 '18 17:07 fchasen

@fchasen i tried it out but it's not working for me, i created issue here can you check that out. #797

bleedweedsuz avatar Jul 25 '18 21:07 bleedweedsuz

!important is needed to override any padding. And not all sides are possible since some already are important.

I need to use custom padding for all sides. Will make a PR soon. Think i'll just add an option to disable epubjs setting padding and column gap (need to change gap as well). Then custom padding and gap can be added with a theme or a class. @fchasen Any thoughts on this?

mikkelvp avatar Oct 18 '18 18:10 mikkelvp

In my epub viewer, I just patched epub.js to remove the vertical padding. I then set the vertical padding on the container, and the horizontal padding in epub.js.

pgaskin avatar Oct 18 '18 19:10 pgaskin

I'm a bit unclear on what you are trying to accomplish.

Any chance you could create a screengrab of what the current padding looks like and what you are trying to change it to?

fchasen avatar Oct 23 '18 00:10 fchasen

@fchasen Just want to be able to set custom padding and gap from rendition options. Gap is already possible. https://i.imgur.com/BsAwEni.png Like this: #855

mikkelvp avatar Oct 23 '18 12:10 mikkelvp

Horizontal paddings are too big for small screens. Please provide an option to override them. telegram-cloud-photo-size-2-5413802725126297190-y

dmitrybabich avatar Jun 08 '24 08:06 dmitrybabich

I had a similar issue, I solved it with:

book.renderTo("bookarea", {width, height, flow:"scrolled-doc", stylesheet: '/book.css'});

And in /book.css:

body > :first-child {
    padding-top: 25px !important;
}

body > :last-child {
    padding-bottom: 125px !important;
}

lucafabbian avatar Feb 25 '25 10:02 lucafabbian