Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 04-27-2010, 01:45 PM   #1
ghostyjack
Guru
ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.
 
ghostyjack's Avatar
 
Posts: 716
Karma: 1085604
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;}
What is the correct syntax for page?

Any help would be most appreciated.
ghostyjack is offline   Reply With Quote
Old 04-27-2010, 03:55 PM   #2
charleski
Wizard
charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.
 
Posts: 1,188
Karma: 727236
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
}
The margin-bottom value is really there just to prevent ADE allowing text to collide with the bottom of the page, which leads to it greying-out the lower pixels of descenders. In practice the actual size of the bottom margin will depend on how many lines fit into a page and whether the orphan rule is being applied.

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.
charleski is offline   Reply With Quote
Old 08-06-2012, 03:23 PM   #3
christiannielsen
Junior Member
christiannielsen began at the beginning.
 
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:
Originally Posted by charleski View Post
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
}
The margin-bottom value is really there just to prevent ADE allowing text to collide with the bottom of the page, which leads to it greying-out the lower pixels of descenders. In practice the actual size of the bottom margin will depend on how many lines fit into a page and whether the orphan rule is being applied.

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.
christiannielsen is offline   Reply With Quote
Old 08-06-2012, 03:24 PM   #4
christiannielsen
Junior Member
christiannielsen began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Aug 2012
Device: none
email sub
christiannielsen is offline   Reply With Quote
Old 08-07-2012, 03:55 PM   #5
mmat1
Det
mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.
 
mmat1's Avatar
 
Posts: 995
Karma: 1529558
Join Date: Jan 2012
Location: Zischebattem
Device: Acer Lumiread
Quote:
Originally Posted by ghostyjack View Post
What things should I have placed in the body tag and what in page?
The only thing I put into the <body> in addtion to the margin (as explained by charleski) is the "font-family".

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.
mmat1 is offline   Reply With Quote
Old 08-07-2012, 06:26 PM   #6
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 38,509
Karma: 19637653
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Aura H2), Sony PRS-650, Sony PRS-T1, nook STR, iPad 1, iPhone 5
Quote:
Originally Posted by mmat1 View Post
The only thing I put into the <body> in addtion to the margin (as explained by charleski) is the "font-family".

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.
Incorrect (I think). Kobo readers have a bug where they will ignore the font-family put in the body style. They will respect font-family elsewhere like <p> or <div>.

I've never heard of any reader that uses ADE that does not respect font-family in <p> or <div>.
JSWolf is online now   Reply With Quote
Old 08-08-2012, 04:20 AM   #7
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 6,315
Karma: 4963983
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by JSWolf View Post
I've never heard of any reader that uses ADE that does not respect font-family in <p> or <div>.
I think he means that if a book specifies a font in <p> or <div>, the user won't be able to choose a different font in the reader.
Jellby is offline   Reply With Quote
Old 08-08-2012, 01:18 PM   #8
mmat1
Det
mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.
 
mmat1's Avatar
 
Posts: 995
Karma: 1529558
Join Date: Jan 2012
Location: Zischebattem
Device: Acer Lumiread
Quote:
Originally Posted by JSWolf View Post
Incorrect (I think). Kobo readers have a bug where they will ignore the font-family put in the body style. They will respect font-family elsewhere like <p> or <div>.

I've never heard of any reader that uses ADE that does not respect font-family in <p> or <div>.
Maybe i didn't state it clearly enough: PB-readers will respect a font-family assignment in body, div and p.

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 01:20 PM.
mmat1 is offline   Reply With Quote
Old 08-08-2012, 05:18 PM   #9
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 38,509
Karma: 19637653
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Aura H2), Sony PRS-650, Sony PRS-T1, nook STR, iPad 1, iPhone 5
Quote:
Originally Posted by mmat1 View Post
Maybe i didn't state it clearly enough: PB-readers will respect a font-family assignment in body, div and p.

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.
It depends on how the font is specified. If you use font-family: "Charis SIL" then no, it won't work to change the font in all readers that support font changing. But if you use font-family: serif then most if not all should be able to change the font. I know the T1 will be able to change the font as long as serif is used as the font name and it doesn't matter where this is used.

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.
JSWolf is online now   Reply With Quote
Old 08-09-2012, 01:42 PM   #10
mmat1
Det
mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.
 
mmat1's Avatar
 
Posts: 995
Karma: 1529558
Join Date: Jan 2012
Location: Zischebattem
Device: Acer Lumiread
Quote:
Originally Posted by JSWolf View Post
It depends on how the font is specified. If you use font-family: "Charis SIL" then no, it won't work to change the font in all readers that support font changing. But if you use font-family: serif then most if not all should be able to change the font. I know the T1 will be able to change the font as long as serif is used as the font name and it doesn't matter where this is used.
Yes there is probably a difference between gerneric fonts (serif, sans-serif and monospace) and embedded fonts (i. e. Charis).

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 ...

Quote:
Originally Posted by JSWolf View Post
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.
Business as usual ....
mmat1 is offline   Reply With Quote
Old 08-10-2012, 09:56 PM   #11
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 38,509
Karma: 19637653
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Aura H2), Sony PRS-650, Sony PRS-T1, nook STR, iPad 1, iPhone 5
Quote:
Originally Posted by mmat1 View Post
Yes there is probably a difference between gerneric fonts (serif, sans-serif and monospace) and embedded fonts (i. e. Charis).

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 ...
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.
JSWolf is online now   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Any body sujjest me? softengdeb News 6 02-24-2010 01:25 PM
hello every body gsm1 Introduce Yourself 6 01-10-2010 11:19 PM
Hello every body. windding Introduce Yourself 1 04-11-2008 12:24 PM
Mystery and Crime Lacy, Ed: Go For The Body. v1. 15 July 07 Dr. Drib BBeB/LRF Books (offline) 1 07-16-2007 08:36 AM


All times are GMT -4. The time now is 05:11 PM.


MobileRead.com is a privately owned, operated and funded community.