Quote:
Originally Posted by Turtle91
Warning - channeling my inner Tex here 
|
Quote:
Originally Posted by Jellby
Personally, I prefer to be more specific in my CSS, so I know what each class is intended for, and if I later use <p class="copy"> or <em class="copy"> for something different, the generic ".copy" selector won't bite me in back.
|
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:
- <div class="copy">
- Handles the surrounding "box"-specific stuff.
- Like top/bottom/left/right margins.
- <p class="copy">
- Handles the text-specific stuff.
- Like text-indent, text-align, font-size, [...].
Quote:
Originally Posted by DaveLessnau
In almost every epub that I play with, I see things like:
Code:
<br class="calibre1"/>
[...] But, what's the point? Is the class merely to set the size of the break inserted?
|
Completely depends on the file.
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>
This allows:
- 1st line = Chapter Number
- 2nd line = Chapter Title
(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:
- 1st line = Author + Title
- 2nd line = Publisher + Pages
3. Poetry
Code:
<p class="poem">This is a poem,<br/>
that continues<br/>
to a third line.</p>
Similar to what we just discussed yesterday in
"Poetry Classes: Blockquote vs Div?". (Personally, I wouldn't use the <br/> method... but it is one valid way of doing it.)
4. Addresses
Code:
<p>Send your package to:</p>
<p>123 Main St.<br/>
City Name, ST<br/>
99999</p>
5. Table Headers (especially Units)
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>
where someone accidentally left invisible "ENTER"s at the end of their chapters/paragraphs.
- - - - -
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:
- Hard Enter = ¶ (pilcrow)
- Soft Enter = ↵
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:
Originally Posted by Turtle91
Please don't get overwhelmed by our little disagreements... it is mostly just minor differences in technique. Both will get you what you want and look the same way...
|
Quote:
Originally Posted by Turtle91
my techniques just happen to be better in every way! 
|
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!!!