Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Apr 2012
    Posts
    17
    Thanks
    3
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,667
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    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.

    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>
    ...

    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, &#91;code&#93;&#91;/code&#93; - 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

  • #3
    New Coder
    Join Date
    Apr 2012
    Posts
    17
    Thanks
    3
    Thanked 0 Times in 0 Posts
    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.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •