Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-04-2012, 03:57 AM   PM User | #1
pnielsen
New Coder

 
Join Date: Apr 2012
Posts: 13
Thanks: 3
Thanked 0 Times in 0 Posts
pnielsen is an unknown quantity at this point
Formatting Code for eBooks - See Linked File

I have spent the past few days learning HTML, on my own, so as to produce code for formatting eBooks. There is no one around I can go to for advice, so could someone here please have a look and make any relevant suggestions. The txt. file is here on my personal web space.

http://users.tpg.com.au/pnielsen/Book%20Code.txt

Feel free to copy and paste any or all of it to the forum for commenting. I didn't know if that was allowed, so I just provided the above link.

One question I have is the correct nesting order for alignment, font, and formatting attributes. For example, it seems less repetitious that a <p> should follow the font attribute when there are multiple pages of paragraphs with the same formatting. What is the standard?

I realize some of the tags are depreciated. I would like to sort that out next and put CSS in the header. Any advice along these lines would also be much appreciated.
pnielsen is offline   Reply With Quote
Old 11-04-2012, 03:09 PM   PM User | #2
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
Hello pnielsen,
Wow, huge question! I looked at this last night and passed on it because there was so much to cover.

This morning, maybe I'll start the ball rolling by addressing one or two issues. Maybe someone else will jump in as well.

Quote:
One question I have is the correct nesting order for alignment, font, and formatting attributes. For example, it seems less repetitious that a <p> should follow the font attribute when there are multiple pages of paragraphs with the same formatting. What is the standard?

I realize some of the tags are depreciated. I would like to sort that out next and put CSS in the header. Any advice along these lines would also be much appreciated.
This is really the same question. You already recognize some of the limitations of the inline styles you're using right now. One simple entry in your CSS would style all your <p> tags and completely eliminate the repetition.

Look at this example -
Code:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
<style type="text/css">
html, body {
	margin: 0;
	font: 100% "Trebuchet MS", Arial, Helvetica, sans-serif;
	color: #000;
	background: #fc6;
}
#container {
	width: 760px;
	margin: 0 auto;
	padding: 20px;
	background: #999;
	text-align: center;
}
img#cover {margin: 0 auto;}
</style>
</head>
<body>
        <div id="container">
        	<img src="../../../../Documents\Publishing\Templates\Kindle Master\book_cover_test3.jpg" alt="description" width="300" height="75" id="cover">
            <h1>Title Here</h1>
            <h2>Introduction</h2>
            <p>
                Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna 
                aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no 
                sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam 
                nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo 
                duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
            </p>
        <!--end container--></div>
</body>
</html>
...

Quote:
Feel free to copy and paste any or all of it to the forum for commenting. I didn't know if that was allowed, so I just provided the above link.
Links are always best, we can see the images that way and the code is readily available if we need it. You are allowed to post code in the forum, this is a forum about code after all. When posting code in the forum, please use the code tags, [code][/code] - available with the # button in the post edit window.
This will wrap your code in a scroll box which greatly helps the readability of your post.

...

Check out the links about validation in my signature line. Validating can find mistakes, depricated code and help you learn the correct way to write code.
__________________
Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad
Excavator is offline   Reply With Quote
Old 11-04-2012, 08:03 PM   PM User | #3
pnielsen
New Coder

 
Join Date: Apr 2012
Posts: 13
Thanks: 3
Thanked 0 Times in 0 Posts
pnielsen is an unknown quantity at this point
Thank you for your suggestions.

By "eliminating the repetition" I understand you mean of the font tags. I assume the <p> tags are still done manually. eBooks support a limited number of tags so this simplifies CSS. Some formating is done automatically by the reading device.

So how is the linked code otherwise, as a whole? Any "bad practice" issues I need to ditch?

http://users.tpg.com.au/pnielsen/Book%20Code.txt

Should it be XHTML compliant? Are header tags (h1, etc) standard now? I never could fathom the rationales for the many ways to specify font size: px, pt. em, +2, etc.

Coding is actually fun, once you get started. But I can't figure out exactly why.
pnielsen is offline   Reply With Quote
Reply

Bookmarks

Tags
code, ebook, formatting, html

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:19 AM.


Advertisement
Log in to turn off these ads.