04-27-2010, 12:45 PM | #1 |
Guru
Posts: 718
Karma: 1085610
Join Date: Mar 2009
Location: Bristol, England
Device: PRS-T1, 1825PT, Galaxy Tab, One X, TF700T, Aura HD, Nexus 7
|
Page or Body?
I'm trying to create a standard CSS file that I can import into my epub files. This file will contain all the standard content that I would need for most of my epub files. If the epub need any specific css code, I can always add it later.
One area that I'm not certain about is the use of "body" and "page". What is the difference between body and page? What things should I have placed in the body tag and what in page? For the body tag I would have it in CSS like: Code:
body {element1:x; element2:y;} Any help would be most appreciated. |
04-27-2010, 02:55 PM | #2 |
Wizard
Posts: 1,196
Karma: 1281258
Join Date: Sep 2009
Device: PRS-505
|
The @page directive differs from a tag rule in that it refers to the page that's actually displayed rather than a logical entity. The only attributes that you can use govern the margins, and, since there's no font size defined in this context, you have to use absolute measurements or % values.
Generally, margin-top and margin-bottom are best placed in the @page directive, where they will govern the top and bottom margins of each displayed page. The margin-top and -bottom values in the body definition will govern the margins of the entire flow, so if you have some text that flows over several pages, the margin-top value from body would be seen on the first page, and the bottom value on the last page, which would probably not be what you want. You could place margin-left and -right values in the @page rule, but ADE places its right-side page numbers inside the page, but outside the body. This means that to get maximum clearance between these page numbers and the text it's best to leave the @page margin-left and -right at 0, then define a left and right margin in the body. What I use is: Code:
@page { margin-top: 9pt; margin-bottom: 1pt } body { margin-left: 12pt; margin-right: 12pt } I prefer to use absolute values for the page margins (the one area where this makes sense), but it's possible to use % values instead, in which case the size of the margin varies with the size of the display. This can help to modulate margin size for those reading on small devices like smartphones, but may lead to needlessly large margins on bigger screens. A value of 2% is usually best if you go this route, larger vlaues can lead to problems. |
08-06-2012, 02:23 PM | #3 | |
Junior Member
Posts: 2
Karma: 10
Join Date: Aug 2012
Device: none
|
thanks
This information was very useful.
Also, body margin doest overrule the browser standard margin preferences, isnt that correct? I want to define page margin for safari iOS, but @page is not supported by safari. Do you know any alternative solution? Quote:
|
|
08-06-2012, 02:24 PM | #4 |
Junior Member
Posts: 2
Karma: 10
Join Date: Aug 2012
Device: none
|
email sub
|
08-07-2012, 02:55 PM | #5 | |
Berti
Posts: 1,196
Karma: 4985964
Join Date: Jan 2012
Location: Zischebattem
Device: Acer Lumiread
|
Quote:
Usually the font of my books is only defined there. There are some devices out in the world which have problems to display the font defined by the user in his reader, if the font is assigned to every <p> or <div> tag. |
|
08-07-2012, 05:26 PM | #6 | |
Resident Curmudgeon
Posts: 73,650
Karma: 127838196
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
I've never heard of any reader that uses ADE that does not respect font-family in <p> or <div>. |
|
08-08-2012, 03:20 AM | #7 |
frumious Bandersnatch
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
|
08-08-2012, 12:18 PM | #8 | |
Berti
Posts: 1,196
Karma: 4985964
Join Date: Jan 2012
Location: Zischebattem
Device: Acer Lumiread
|
Quote:
If the font family is only assigned to the body, then the user will be able to select another font on his reader without problems. Any font-assignment to a p/div/span will prevent this, this section is always displayed in the font the bookmaker assigns to it. Concerning the Kobo-Bug: I don't care. Kobo shall fix it. Last edited by mmat1; 08-08-2012 at 12:20 PM. |
|
08-08-2012, 04:18 PM | #9 | |
Resident Curmudgeon
Posts: 73,650
Karma: 127838196
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
As for the Kobo, no, they will not fix the bug. They've known about it since the original Kobo and I've even PMed Kobo staff on MR about it on the Touch and still they refuse to fix the bug. If they were going to fix it, it would have been fixed by now. |
|
08-09-2012, 12:42 PM | #10 | |
Berti
Posts: 1,196
Karma: 4985964
Join Date: Jan 2012
Location: Zischebattem
Device: Acer Lumiread
|
Quote:
I understand, that the T1 won't change the font on userinterface if there is an embedded font defined, but is fine with generic fonts ... Business as usual .... |
|
08-10-2012, 08:56 PM | #11 |
Resident Curmudgeon
Posts: 73,650
Karma: 127838196
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
You misunderstood. The T1 replaces serif with the selected font. That's why if you use serif as the name of the embedded font, it can be changed.
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Any body sujjest me? | softengdeb | News | 6 | 02-24-2010 12:25 PM |
hello every body | gsm1 | Introduce Yourself | 6 | 01-10-2010 10:19 PM |
Hello every body. | windding | Introduce Yourself | 1 | 04-11-2008 11:24 AM |
Mystery and Crime Lacy, Ed: Go For The Body. v1. 15 July 07 | Dr. Drib | BBeB/LRF Books (offline) | 1 | 07-16-2007 07:36 AM |