View Single Post
Old 07-09-2009, 04:47 AM   #5
AlexBell
Wizard
AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.
 
AlexBell's Avatar
 
Posts: 3,413
Karma: 13369310
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad, Samsung SB 2 tablet
Quote:
Originally Posted by HarryT View Post
One thing to consider is that, for a Mobi book, using "<p>" leaves a small gap between the paragraphs, whereas using "<div>" does not.
I'm certainly not an HTML/CSS expert, but I think you'll find that the differences between <div> and <p> go much further than that. From memory, since I don't have the time at the moment to check my favourite book 'HTML, XHTML, & CSS' by Elizabeth Castro
- <div></div> is used for divisions of the document (hence the name)
- <p></p> is used for paragraphs (hence the name) which are usually much smaller sections - one can have many paragraphs within a division.
Both div and p are block level elements, so that the display starts a new line after the closing tag. They can be set to be inline if necessary by display :inline;
- <span></span> is used for smaller sections - eg when one wants to put one word of an sentence in italics. Span is an inline element and does not cause a new line after the closing </span>.

Could I suggest, Harry, that if you don't want a blank line between paragraphs that is better to have something like p {margin: 0;} in your CSS than to use divs? I think your advice would make a website designer sneer.

I know that we are designing ebooks, not websites. But I'd rather make the HTML I use compliant to W3C standards than use the horrible mish-mash which is Mobipocket so that in the future, when ePub is still more highly accepted, my ebooks will still look good.

Regards, Alex
AlexBell is offline   Reply With Quote