View Single Post
Old 07-09-2009, 05:26 AM   #7
zelda_pinwheel
zeldinha zippy zeldissima
zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.
 
zelda_pinwheel's Avatar
 
Posts: 27,827
Karma: 921169
Join Date: Dec 2007
Location: Paris, France
Device: eb1150 & is that a nook in her pocket, or she just happy to see you?
Quote:
Originally Posted by AlexBell View Post
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
Alex is absolutely right. you should always use semantically appropriate html markup, this means using the p (or "paragraph") tag for paragraphs, the h (or "heading") tags for chapter / book headings (titles), and "span" elements for short inline text styling. that's what it's for. if you don't want any space between your paragraphs, simply define that in the css. speaking as a web designer (and fully understanding that an ebook is not a website, but it is nonetheless the same code), i implore you, don't monkey around with invalid markup just because at first glance it seems to give the effect you're looking for. there is plenty of info to be found about html / css markup on the web, starting with the obvious place which would be the Webstandards Consortium or W3C. here are the start pages for their sections about css and html. plenty more info can be found via a quick google search, or even here.
zelda_pinwheel is offline   Reply With Quote