![]() |
#31 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 78,914
Karma: 143095300
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
![]() |
![]() |
![]() |
#32 |
Running with scissors
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,581
Karma: 14328510
Join Date: Nov 2019
Device: none
|
Also note that you can have multiple classes given in the class= thing in your html. I have common block stuff in the div.block css, then I have different classes for letter, verse, etc. In my html I then use div class="block letter". That way you can factor out the common/repeated stuff and put it in the div.block css.
One thing I've always wondered about is how doing it that way compares with using nested divs; e.g. a div class="block" and inside it a div class="letter". Nested divs seems to be more popular. Last edited by hobnail; 07-27-2022 at 11:54 PM. |
![]() |
![]() |
![]() |
#33 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,542
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
If you specify text-indent in both classes, for instance, a nested div will add the indents, while a multi-class div will keep only the one with higher preference.
|
![]() |
![]() |
![]() |
#34 | |
Running with scissors
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,581
Karma: 14328510
Join Date: Nov 2019
Device: none
|
Quote:
Anyhow, thanks; I'm glad to know that there is a difference. Code:
.indent2 { text-indent: 2em; } div.indent1 { text-indent: 1em; } Code:
<div class="indent2"> <p><b>indent2</b> Dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p> </div> <div class="indent2"> <div class="indent1"> <p><b>div indent2, div indent1</b> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p> </div> </div> <div class="indent1"> <div class="indent2"> <p><b>div indent1, div indent2</b> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p> </div> </div> <div class="indent2 indent1"> <p><b>div indent2 indent1</b> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p> </div> <div class="indent1 indent2"> <p><b>div indent1 indent2</b> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p> </div> ![]() Last edited by hobnail; 07-28-2022 at 04:31 PM. |
|
![]() |
![]() |
![]() |
#35 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,291
Karma: 20171067
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've seen nested divs used mostly in things like headers when they want an underline to match just the text in the div...or something similar. I usually delete all of that and use a simple header <h3> with the equivalent css to achieve the same result.
My css sheet might end up being slightly longer - some minimal duplication - but it makes it a lot easier for me to follow what is being done at each point. To each their own! |
![]() |
![]() |
![]() |
#36 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 78,914
Karma: 143095300
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
![]() |
![]() |
![]() |
#37 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,542
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
|
![]() |
![]() |
![]() |
#38 |
Running with scissors
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,581
Karma: 14328510
Join Date: Nov 2019
Device: none
|
|
![]() |
![]() |
![]() |
#39 | |||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
![]() ![]() Quote:
![]() Specificity is good. Like you said, less chance of rogue errors biting you in the butt later. (But if you keep your code very simple... there's little chance of complications happening anyway.) If I do <div> and <p> with the same class names, I split it like:
Quote:
99% of the time, it's crap where the person pressed ENTER ENTER ENTER between paragraphs or did "forced line breaks" in their original document. <1% of the time, it might be a valid use-case, where someone correctly used "soft breaks". Valid Uses of Line Breaks? Very few, if any. Personally, I avoid almost all <br/>... but here's a few I'd put in the "maybe keep" category: 1. Multi-line Headings Code:
<h2>Chapter 1:<br/>The Beginning</h2>
(See linked topic above for more details/tricks.) 2. Multi-line Attribution Code:
<p>This is the best quote.</p> <p class="attribution">—Tex the Great, <i>The Greatest Book Ever</i><br/> (City: Publisher, 2022), pp. 123–456.</p> More readable since both lines are "similar length" + you can make skimming easy because:
3. Poetry Code:
<p class="poem">This is a poem,<br/> that continues<br/> to a third line.</p> 4. Addresses Code:
<p>Send your package to:</p> <p>123 Main St.<br/> City Name, ST<br/> 99999</p> Code:
<table> <tr> <th>Really Long Name</th> <th>Long<br/>Distance<br/>(Miles)</th> <th>Cost<br/>per<br/>Mile<br/>($)</th> <th>Temperature<br/>(°F)</th> </tr> <tr> <td>Tex Example</td> <td>99.9</td> <td>2.22</td> <td>102.2</td> </tr> </table> With the breaks, those number cells will be shorter (one-word wide). Without the breaks, the table could be super wide... hurting readability. For easier skimming, it's also sometimes easier to have Units separated onto their own lines. ... It all depends on the table/data though. (For more info on that, see 2021: "Formatting tables best practices".) Best Way to Remove Breaks? What I do is a pass with this regex: Search: <br ?[^>]*/> Replace: <---- Absolutely NOTHING (or a SPACE) and go through the book, replacing one-by-one while staring at Preview to see if it's actually important. Where is 99% of the <br/> Crud? It's leftover cruft like: Code:
<ul> <li>List</li> <li>List</li> <li>List<br/></li> <---- Remove </ul> <p>End of Chapter 1.<br/></p> <---- Remove <h2>Chapter 2</h2> [...] <p><br /></p> <---- Remove </body> </html> - - - - - Side Note: This last author I worked with, I had to teach him about "Show All" in Word/LibreOffice, so he could visibly see those extra:
Then I taught him how to use Find&Replace to eliminate them, and replace with Styles. ![]() This makes the DOCX/ODT infinitely easier to clean+convert... but most people don't do this, hence lots of garbage introduced into the ebooks. Quote:
![]() ![]() Now you're sounding like a certain canine friend of ours!!! There's only one true way to do it—his way—and if you deviate from it by a nanometer, he'll pounce!!! Last edited by Tex2002ans; 08-01-2022 at 05:42 PM. |
|||
![]() |
![]() |
![]() |
#40 |
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,625
Karma: 103503445
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
<br/> Appears automatically in my chapter headings if I do newline rather than regular enter (which makes a new paragraph) so as to force a two line heading rather than random wrap.
It means any auto TOC generation only has one entry for the chapter rather than two; the renderer auto spaces the two lines according to the font metrics/size. But I can't think of any other situation that uses <br/> that's not better done some other way. Again the goal is to not edit the ebook, but only source, the exception being tweaking CSS for images. I also run search & replace on the WP source so that: There are only single spaces ever. No leading spaces No trailing spaces. No empty paragraphs (In LO, $[ ], [ ]^ and ^$) You'd have to deliberately type a newline as "enter" is always a new paragraph. Last edited by Quoth; 08-01-2022 at 08:07 AM. |
![]() |
![]() |
![]() |
#41 | |
Connoisseur
![]() Posts: 52
Karma: 10
Join Date: Sep 2021
Location: Upstate NY, USA
Device: iPad Pro, Kindle basic
|
Quote:
|
|
![]() |
![]() |
![]() |
#42 |
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
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
"class="calibre"" in the <html header line? | retiredbiker | Conversion | 11 | 06-21-2023 01:25 PM |
Pressing "Restore Defaults" under "Book Details" wipes all "Look & Feel" settings. | MarjaE | Library Management | 1 | 03-30-2021 11:46 AM |
Class action: "sale" royalties on "licensed" ebooks | drjenkins | News | 2 | 06-02-2016 08:44 AM |
Creating Indents on <br class="calibre1" /> | CyanBC | Sigil | 20 | 04-05-2013 11:59 PM |