|  01-31-2017, 07:26 AM | #1 | 
| Head of lunatic asylum            Posts: 349 Karma: 77620 Join Date: Jun 2012 Location: UTC +1 Device: Tolino Vision 3HD | 
				
				Possible CODE-variations?
			 
			
			What's the better way to code the content list of a book? Code: <p><a href="Xyz.html">Xyz</a><br/> <a href="abc.html#DeF">DeF</a><br/> <a href="abc.html#Ghi">Ghi</a></p> or <p><a href="Xyz.html">Xyz</a></p> <p><a href="abc.html#DeF">DeF</a></p> <p><a href="abc.html#Ghi">Ghi</a></p> Last edited by chaot; 02-02-2017 at 02:46 AM. Reason: correcting: ... Ghi</a><br/></p> → ... Ghi</a></p> | 
|   |   | 
|  01-31-2017, 07:36 AM | #2 | 
| Resident Curmudgeon            Posts: 80,727 Karma: 150249619 Join Date: Nov 2006 Location: Roslindale, Massachusetts Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 | |
|   |   | 
|  01-31-2017, 08:33 AM | #3 | 
| A Hairy Wizard            Posts: 3,395 Karma: 20212733 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 agree with Jon about not needing an ID if you are linking to the top of the page, but I disagree with his statement that it is "poor coding" to use <br/>. There are two different purposes for the <br/> (go to the next line) and the <p> (start a new paragraph element). Technically (semantically) you aren't starting a new paragraph with each line of a TOC so a <br/> (or a <div> for that matter) would work fine. Effectively they will do mostly the same thing under most conditions, but they are semantically different. Honestly, if there isn't a specific reason for using one or the other, it's a matter of preference for which one you use.  I personally use the <p> tags... but that's just a habit instead of any particular reason. Cheers, | 
|   |   | 
|  01-31-2017, 03:49 PM | #4 | 
| Grand Sorcerer            Posts: 11,470 Karma: 13095790 Join Date: Aug 2007 Location: Grass Valley, CA Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7 | 
			
			Semantics do matter. Another interesting fact about /br is that it is ignored in the TOC generation by programs that auto-create the toc. So a multi-line title will show as one line in the TOC which is useful sometimes. Dale | 
|   |   | 
|  01-31-2017, 04:22 PM | #5 | 
| Resident Curmudgeon            Posts: 80,727 Karma: 150249619 Join Date: Nov 2006 Location: Roslindale, Massachusetts Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 | 
			
			I've reported that all four threads on this one ToC be merged.
		 Last edited by JSWolf; 01-31-2017 at 04:25 PM. | 
|   |   | 
|  01-31-2017, 10:54 PM | #6 | |
| Curmudgeon            Posts: 629 Karma: 1623086 Join Date: Jan 2012 Device: iPad, iPhone, Nook Simple Touch | Quote: 
 For a TOC, I would tend to use <ul><li> or <ol><li>. The content you're formatting is semantically a nested list. With the right styling, it can look like anything you want it to look like, but using proper list tags preserves the semantics of the content in the structure, which can be beneficial in some screen readers, IIRC, and also is useful for folks scraping the book and processing it in interesting ways. So the short answer is that you probably shouldn't use either of the styles that you asked about.   Last edited by dgatwood; 01-31-2017 at 10:56 PM. | |
|   |   | 
|  02-01-2017, 06:50 AM | #7 | |
| Resident Curmudgeon            Posts: 80,727 Karma: 150249619 Join Date: Nov 2006 Location: Roslindale, Massachusetts Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 | Quote: 
 | |
|   |   | 
|  02-01-2017, 10:53 AM | #8 | |
| A Hairy Wizard            Posts: 3,395 Karma: 20212733 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: 
 <p class="someclass">something</p> <p class="someclass">someone</p> <p class="someclass">somewhere</p> to duplicate the look of: <p class="someclass">something<br/>someone<br/>somewhere</p> interesting. Although, as I said, I use something like: <div class="someclass"> <p>something</p> <p>someone</p> <p>somewhere</p> </div> and define CSS: div.someclass p {whatever} There are multiple ways to make it look the same. The only real difference is how semantically correct you want it to be. I actually think dgatwood had the better argument that a <ul><li> is more semantically correct. It's just very difficult to understand why you would tell someone their way is "poor coding" and yet you give them an example of equally poor coding without explaining your reasoning.  Cheers! | |
|   |   | 
|  02-01-2017, 11:09 AM | #9 | 
| Resident Curmudgeon            Posts: 80,727 Karma: 150249619 Join Date: Nov 2006 Location: Roslindale, Massachusetts Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 | 
			
			Because <br/> is always described as poor coding.
		 | 
|   |   | 
|  02-01-2017, 11:13 AM | #10 | 
| Head of lunatic asylum            Posts: 349 Karma: 77620 Join Date: Jun 2012 Location: UTC +1 Device: Tolino Vision 3HD | |
|   |   | 
|  02-01-2017, 11:14 AM | #11 | 
| Resident Curmudgeon            Posts: 80,727 Karma: 150249619 Join Date: Nov 2006 Location: Roslindale, Massachusetts Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 | |
|   |   | 
|  02-01-2017, 11:33 AM | #12 | 
| Head of lunatic asylum            Posts: 349 Karma: 77620 Join Date: Jun 2012 Location: UTC +1 Device: Tolino Vision 3HD | 
			
			Sorry! It's not like this. In all my recently opened threads, different questions are dealt with. In my opinion, a merger is impossible. I contradict this request most decidedly.
		 | 
|   |   | 
|  02-01-2017, 12:16 PM | #13 | 
| Head of lunatic asylum            Posts: 349 Karma: 77620 Join Date: Jun 2012 Location: UTC +1 Device: Tolino Vision 3HD | 
			
			A list of contents is a list per definitionem. And that's exactly why this should be semantically reflect in the code. (Similar as <i> or <em>.) @dgatwood   Karma is distributed to everyone involved! ...there are many roads leading to Rome. Even if there are good and less good ones. According to the original look of the book I code an <ul> list inside/not inside (not yet decided) <div></div> tags. Last edited by chaot; 02-02-2017 at 02:59 AM. Reason: change: Same → Similar | 
|   |   | 
|  02-01-2017, 12:26 PM | #14 | 
| Resident Curmudgeon            Posts: 80,727 Karma: 150249619 Join Date: Nov 2006 Location: Roslindale, Massachusetts Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 | |
|   |   | 
|  02-01-2017, 12:38 PM | #15 | 
| Head of lunatic asylum            Posts: 349 Karma: 77620 Join Date: Jun 2012 Location: UTC +1 Device: Tolino Vision 3HD | 
			
			Supreme forum rule: One question - one thread. Otherwise complaints will come, one would spare the effort of different threads. And even if you were right here, I will learn much more on this path, or better said on these paths. That's it! Last edited by chaot; 02-10-2017 at 12:20 PM. Reason: Supreme (divine) forum → Supreme forum, grammatical issues | 
|   |   | 
|  | 
| 
 | 
|  Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Cover page variations: Suggestions please? | AndrewMowere | Writers' Corner | 22 | 12-29-2016 07:01 PM | 
| Merge Author name variations to a list | mkkyah | Library Management | 15 | 11-13-2016 03:32 PM | 
| 4fff n618 and variations | frq | More E-Book Readers | 22 | 04-04-2011 09:02 PM | 
| Classic What do Nook firmware variations 1.4.1, 1.4.2, 1.4.3 mean? | chas0039 | Barnes & Noble NOOK | 6 | 11-15-2010 12:45 PM | 
| Puzzled by contrast variations in e-ink | Sunspark | News | 3 | 12-15-2009 03:53 AM |