![]() |
#31 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,064
Karma: 144284144
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Even if it's a multi-line header/title/whatever, I still consider <br/> sloppy.
It just means you didn't take make the effort to code the CSS. Code:
h1 { text-align: center; } .spacet { padding-top: 2em; text-indent: 0; } .spaceb { padding-bottom: 2em; text-indent: 0; } _________________ <h1 class="spacet">LOVE AMONG</h1> <h1>THE</h1> <h1 class"spaceb">CHICKENS (A FOWL LOVE STORY</h1> <h1>BY P.G. WOODHOUSE</h1> Code:
<p class="spacet">The beginning of the next section.</p> |
![]() |
![]() |
![]() |
#32 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 281
Karma: 7724454
Join Date: Sep 2017
Location: Bethesda, MD, USA
Device: Kobo Aura H20, Kobo Clara HD
|
Quote:
You're definitely right about <br /> being a code smell to avoid, but splitting the header into multiple h1 tags like this is much worse; using <h1>Love Among<br />The<br />Chickens</h1> is pretty gross, but it's far better than this approach. The h1/h2/h# tags are header tags: they semantically indicate that the contents are a full header of the given level. You should almost never (arguably never, but there's probably a weird case where it's okay) have two adjacent h1 (or h2, or h3, etc) tags at the same level, and each header tag should include a full header text within it. When you use 4 different h1 headers like this, you are semantically saying here that there are 4 different headers: you're saying that "LOVE AMONG", "THE", "CHICKENS (A FOWL LOVE STORY", and "BY P.G. WODEHOUSE" are legitimate, distinct headers. That's nonsense; it's bad enough that it indicates to the human reader that you have 4 different headers (Part 1: "Love Among". Part 2: "The". etc), but it also means that most tools (which understand header fields as intended) will create a table of contents that has: Table of Contents: 1. Love Among 2. The 3. Chickens (A Fowl Love story 4. By P. G. Wodehouse Header tags (h1, h2, h3, etc) are meant to indicate that their contents are full, single headers, semantically, and it's definitely worth structuring them that way so that readers aren't confused and automated tools work properly. The proper solution is to avoid both br tags and multiple headers (see my last post for one approach, though there are many ways to do this). But if you avoid "br" by doing something like this, you've missed the whole point and made things even worse. Last edited by sjfan; 02-26-2018 at 01:29 AM. |
|
![]() |
![]() |
Advert | |
|
![]() |
#33 |
Obsessively Dedicated...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,202
Karma: 34984330
Join Date: May 2011
Location: JAPAN (US expatriate)
Device: Sony PRS-T2, ADE on PC
|
Would someone please clarify why using <br /> is so reprehensible?
Do you mean only in <hn> headers, or in paras and divs as well? It seems the simplest way to force a linebreak without putting part of your sentence into a new para or div. (Especially when you are centering a text string, and don't want an awkward break in the "flow".) Maybe I'm just slow on the uptake.... Educate me, please! Last edited by GrannyGrump; 02-26-2018 at 04:46 AM. |
![]() |
![]() |
![]() |
#34 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,623
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
@GrannyGrump
I use the <br/> tag to insert line-breaks when needed. As far as I know, it's correct xhtml... ![]() https://www.w3schools.com/tags/tag_br.asp |
![]() |
![]() |
![]() |
#35 |
Obsessively Dedicated...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,202
Karma: 34984330
Join Date: May 2011
Location: JAPAN (US expatriate)
Device: Sony PRS-T2, ADE on PC
|
@roger --- I use it often myself, and this thread is the first time I recall that anybody recommended to avoid that. Maybe there is a secret magic voodoo reason ???
|
![]() |
![]() |
Advert | |
|
![]() |
#36 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#37 |
Obsessively Dedicated...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,202
Karma: 34984330
Join Date: May 2011
Location: JAPAN (US expatriate)
Device: Sony PRS-T2, ADE on PC
|
So... if I want to style, for example, a "For Sale" sign.
I should style it as such: <div class="centrd">FOR SALE</div> <div class="centrd">FRESH STRAWBERRIES</div> <div class="centrd">ENQUIRE WITHIN</div> Rather than <div class="centrd">FOR SALE<br /> FRESH STRAWBERRIES<br /> ENQUIRE WITHIN</div> I simply do not comprehend why the <br /> is any uglier than multiple <div>s. Plus, you have what might be considered extraneous tags... Educate me some more, please? |
![]() |
![]() |
![]() |
#38 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,303
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
I think the main aversion to <br/> is using them to create space between/before/after paragraphs.
Bad: Code:
<p>Last paragraph in a section with a space following.<br/><br/></p> <p><br/><br/>First paragraph in a section with space preceeding.</p> <p><br/></p> 'empty line Code:
CSS: h1 {margin-top: 2em; margin-bottom: 2em; text-align: center;} h1 span {display:block; font-size:.8em} Text: <h1>LOVE AMOUNG<br/>the<br/>CHICKENS<span>by P. G. Wodehouse</span></h1> Code:
CSS: h1 {margin-top: 2em; margin-bottom: 2em; text-align: center;} p.auth {font-size:.8em; margin-bottom: 2em; text-align: center} Text: <h1>LOVE AMOUNG<br/>the<br/>CHICKENS</h1> <p class="auth">by P. G. Wodehouse</p> In fact, if you want to create a linefeed within the same container - without creating a new container - it is appropriate to use <br/>. GrannyGrump's use of <br/> inside of the <div> is much better/cleaner than the multiple <div> statements. The <br/> is used as a linefeed without having to reapply the container's formatting (margin's, padding, indent, etc), it simply continues on the next line. According to W3Schools "Use the <br> tag to enter line breaks, not to separate paragraphs." Cheers, |
![]() |
![]() |
![]() |
#39 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,064
Karma: 144284144
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
Here's good code... .noindent { text-indent: 0; } div.center { text-align: center; margin-top: 1em; margin-bottom: 1em; } <div class="center"> <p class="noindent">FOR SALE</p> <p class="noindent">FRESH BLUEBERRIES</p> <p class="noindent">INQUIRE WITHIN</p> </div> |
|
![]() |
![]() |
![]() |
#40 | |
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
There is also the reality that not all reading systems will necessarily recognize breaks. Most do, no argument. But not all. Does anyone else remember some kerfuffle, over this, about...5+ years ago? Some eReader that didn't honor the multiple breaks? Hitch |
|
![]() |
![]() |
![]() |
#41 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,064
Karma: 144284144
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Do you recall that Reader it was?
|
![]() |
![]() |
![]() |
#42 | |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,303
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Quote:
![]() ![]() ![]() That is just as bad as worse than the multiple <div>s. If you insist on having separate paragraphs...which are unnecessary and semantically incorrect...then at most you would use: Code:
div.center {margin:1em auto} div.center p {text-align:center; text-indent:0} <div class="center"> <p>FOR SALE</p> <p>FRESH BLUEBERRIES</p> <p>INQUIRE WITHIN</p> </div> Code:
div.center {margin:1em auto; text-align:center; text-indent:0} <div class="center">FOR SALE<br/>FRESH BLUEBERRIES<br/>INQUIRE WITHIN</div> Last edited by Turtle91; 02-26-2018 at 03:39 PM. |
|
![]() |
![]() |
![]() |
#43 |
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
|
![]() |
![]() |
![]() |
#44 |
Obsessively Dedicated...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,202
Karma: 34984330
Join Date: May 2011
Location: JAPAN (US expatriate)
Device: Sony PRS-T2, ADE on PC
|
|
![]() |
![]() |
![]() |
#45 | |
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
C'mon. You know that I tend to agree with you about stringency in coding, BUT...there is no advantage or preference, or anything like that, in having multiple divs over multiple paragraphs, or vice-versa. Cleanliness in coding means elegance, as well as thrift--being concise, and "correct" in what you code. There is no standard, no "school" of HTML/CSS that would ever say that X divs over X ps is better. The "good" versus "bad" is viewed based not on personal opinion (although, surely, that plays into it in some discussions, unfortunately), but based on other factors. In the web world, elegance in coding is based on concision and functionality. In other words, being concise is worthless, if the code only works in two out of 5 browsers. We can all, I'm sure, remember being impressed with what could be done with HTML5, compared to what we would have had to do a mere 5 years earlier to achieve the same ends. In ebooks, the same is true. I cannot think of a single device, not even Kindles, that would display multiple ps differently than multiple divs, or vice-versa. Given that there is no expert, on HTML, that would claim one is superior to the other, then claiming that ps are better than divs is, sweetie, just downright silly. They're not. In fact, I could probably construct an "argument" for either of the positions, that "divs" are better, or that ps are better. The discussion about empty paragraphs as "bad" came about simply because there are several devices that just won't honor them, Kindle amongst them. And no matter what any ePUB-ficionado claims, let's not be pedantic; Amazon's might is absolutely affecting the reality of what's "good" coding. I know that somewhere in time, a device did not recognize multiple breaks inside...something. THAT, I can't recall, but as a consequence, my guys know that using breaks to create coding, unless there's a good reason, is a "talking-to" offense. (They get to suffer hearing me discuss it with them.) That's because typically, they're used as a shortcut, rather than an appropriate use (4 lines of a song, let's say, or yon Blueberries sign--the only ones in the ePUB. In that instance, I would hardly quibble over my guys using the break element, rather than setting up 4 lines of a new para class). How many people use hr's, for decoration? Between a heading, say, and the body of a book? Dozens? Hundreds? Thousands? Yet, arguably, that use is wrong--an hr is supposed to be a "thematic break," not a decoration. Should we horsewhip those who use it? Divs and ps are both block-level elements; they can contain other elements, and frequently do. It's not like you're talking the difference between one element that's a block and one that's an inline, here. A div is a container, pretty much--and arguably, for all intents and purposes, so is a paragraph. A paragraph contains text; it can contain images, etc. I really don't think, Jon, that there's a good argument for saying that using one over the other is "superior." Sure, semantically, you could try to argue that the lines in the Blueberries sign are more akin to paragraphs (of text) than divs; but if you go down that road, really, you'd be forced to take the position that it's genuinely a paragraph of text--with line breaks, and thus, be forced to say that a single para, with the break tag deployed, is the "better" coding answer. See what I mean? Hitch |
|
![]() |
![]() |
![]() |
Tags |
endnote, epub, hide |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Plugin] epub2 output | Doitsu | Plugins | 11 | 12-01-2021 04:17 PM |
epub3 to epub2 | AlanHK | Sigil | 11 | 08-09-2017 05:06 AM |
EPUB2 to EPUB 3 errors | Psymon | ePub | 38 | 03-12-2016 01:12 PM |
EPUB2 and the DOCTYPEgate | roger64 | ePub | 21 | 07-18-2014 07:49 PM |
refined metadata in epub2? | mzmm | ePub | 2 | 11-14-2012 01:52 PM |