View Single Post
Old 02-27-2018, 04:47 AM   #45
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
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:
Originally Posted by JSWolf View Post
Multiple divs like that are ugly. Why would you use them where p is best?
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>
Now, Jon:

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
Hitch is offline   Reply With Quote