![]() |
#1 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 972
Karma: 4999999
Join Date: Mar 2009
Location: Rosario, Argentina
Device: SONY PRS-T2, Kindle Paperwhite 11th gen
|
Problem with <br /> tags
I am using Sigil 0.2.0.
When importing html files, <br /> tags get converted to Code:
<p> <br /> </p> Is it illegal to have an isolated <br /> tag in one line in epub? |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1281258
Join Date: Sep 2009
Device: PRS-505
|
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 972
Karma: 4999999
Join Date: Mar 2009
Location: Rosario, Argentina
Device: SONY PRS-T2, Kindle Paperwhite 11th gen
|
|
![]() |
![]() |
![]() |
#4 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1281258
Join Date: Sep 2009
Device: PRS-505
|
That's a block margin. Margins aren't only at the sides of the page. Just use a style class with margin-top:1.2em (or whatever your line-height is, 1.2 is the default). I know a lot of people misuse br tags line this (or, worse, use <p> </p>), but it's a bad habit to adopt.
|
![]() |
![]() |
![]() |
#5 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 972
Karma: 4999999
Join Date: Mar 2009
Location: Rosario, Argentina
Device: SONY PRS-T2, Kindle Paperwhite 11th gen
|
Quote:
|
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1281258
Join Date: Sep 2009
Device: PRS-505
|
I typically use the following css:
.indent { margin: 0; text-indent: 1em } .flush { margin-top: 1.25em; margin-bottom: 0; text-indent: 0 } Then the text goes: <p class="indent">This paragraph has the first line indented. Lorem ipsum dolor sit amet, id euismod, consectetuer nec aliquam. Sagittis amet, nec nunc, qui accumsan turpis. A tempus, class aliquam tempor, eget wisi. Enim duis eros, ut eros. Mauris ut lectus, lorem semper, leo ut convallis.</p> <p class="flush">This paragraph will appear with a blank line above it and without an indent. Adipiscing posuere, lobortis nec nec, ipsum iaculis. Aliquam posuere dolor, leo nulla, nulla mi. Wisi ut commodo, justo tellus vel. Vitae occaecati platea. Nam a sapien, porta lacus platea, pellentesque eleifend.</p> |
![]() |
![]() |
![]() |
#7 |
Reader
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 520
Karma: 24612
Join Date: Aug 2009
Location: Utrecht, NL
Device: Kobo Aura 2, iPhone, iPad
|
|
![]() |
![]() |
![]() |
#8 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 972
Karma: 4999999
Join Date: Mar 2009
Location: Rosario, Argentina
Device: SONY PRS-T2, Kindle Paperwhite 11th gen
|
Quote:
|
|
![]() |
![]() |
![]() |
#9 | |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 155
Karma: 200000
Join Date: Dec 2009
Location: Britania
Device: Android
|
Quote:
What is the reason for preferring this approach to an "empty paragraph" / line break tag / etc? Doesn't this break the principle that HTML should be semantic, and that it should degrade gracefully? Suppose you do this on a website. Suppose you also have some styling that unfortunately makes it unreadable for me on my device - due to colour, screen width, font choice / size or something. In my case, I have a netbook with an 800px wide screen - which is too narrow for some sites. So I disable styles (View -> Page style -> None). Now I miss your "block margin". |
|
![]() |
![]() |
![]() |
#10 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,543
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Semantically, there is not a blank line, there is, at most, some "break" in the story, a change in scene, an unnamed section break, whatever. And to mark this you can either:
Code:
<p>This is a normal paragraph.</p> <p class="scene-break">This is a paragraph after a break.</p> Code:
<p>This is a normal paragraph.</p> <div class="scene-break"/> <p>This is a paragraph after a break.</p> And of course there will be cases where this is not rendered exactly the same with and without CSS, that's the whole point of CSS and content/formatting separation. Anyway, this is ePUB, and ePUB readers are required to support CSS. |
![]() |
![]() |
![]() |
#11 |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 155
Karma: 200000
Join Date: Dec 2009
Location: Britania
Device: Android
|
Good point. I think <div class="break"> </div> is the lesser evil, but then epub gets held to different standards than the Web. (And this is a point of divergence from the web; there's no universally endorsed best practise for this because by default websites will separate _all_ paragraphs with a blank line).
More relevantly: I found a related thread. Summary: test your scene breaks carefully on ADE, because it can potentially re-arrange paragraphs in a way that will insert extra blank lines at the end of pages, making it impossible to see where the actual scene breaks are. (Read the thread to work out what you need to test). With the <div> method, you have to use CSS to ensure that the <div> doesn't end up at the end of a page. If margin-top avoids that problem, I guess that makes it simpler to use. (It also suggests you shouldn't use margin-bottom to create scene breaks... but I expect my ignorance is showing here). Last edited by sourcejedi; 08-18-2010 at 02:52 PM. Reason: formatting & nitpicks |
![]() |
![]() |
![]() |
#12 |
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
|
I'm self-taught with HTML/XHTML so haven't been taught any "best practice" techniques.
I generally use <p> </p> as a scene break when I have "margin: 0" in the p tag in the CSS file. This works, what's the problem with it? |
![]() |
![]() |
![]() |
#13 |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 155
Karma: 200000
Join Date: Dec 2009
Location: Britania
Device: Android
|
ghostyjack: That's the same as the second option Jellby presented. The only difference is Jellby said "div" instead of "p" - after all, the blank line isn't actually a paragraph. Which sounds like a good idea to me, but I don't know whether it would ever matter.
|
![]() |
![]() |
![]() |
#14 |
Not who you think I am...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 374
Karma: 30283
Join Date: Jan 2010
Location: Honolulu
Device: PocketBook 360 -- Ivory
|
No, he didn't. He wrote:
Code:
<div class="scene-break"/> The div above doesn't add anything and can be displayed (or not) in any manner that CSS describes. The structure is marked up in his example, but the display of a blank line is not forced. If someone wanted to display scene breaks with a set of diamonds, or asterisks or a horizontal line or an image of a giant dinosaur, there would be no way to do it in any example that contains a plain paragraph, or a plain line break. |
![]() |
![]() |
![]() |
#15 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1281258
Join Date: Sep 2009
Device: PRS-505
|
Actually the clearest way of doing it would probably be
<div class="scene"> <p>...</p> <p>...</p> <p>...</p> </div> <div class="scene"> etc. with div.class + p { text-indent: 0 } But I don't think in practice this really gains anything over merely indicating the semantics with a class change. Changing a class is a perfectly valid way of indicating that one block has different semantics to another. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Tags gone again | ccowie | Calibre | 5 | 07-26-2010 01:53 PM |
Problem with collections/tags | Shadowjack | Calibre | 11 | 04-21-2010 09:25 AM |
<br /> Tags | ghostyjack | Sigil | 5 | 09-14-2009 07:08 AM |
Tags import problem | femto | Calibre | 10 | 04-22-2009 04:39 AM |
Tags | pcmedic | Sony Reader | 7 | 02-19-2009 09:36 AM |