MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Sigil (https://www.mobileread.com/forums/forumdisplay.php?f=203)
-   -   Where To Put <style type="text/css"> Code (https://www.mobileread.com/forums/showthread.php?t=232369)

SeaCanary 01-28-2014 04:11 PM

Where To Put <style type="text/css"> Code
 
I built an epub file that has many html files in it. Every html file has the following code.
Code:

<head>
  <title>Only Remembered</title>
  <link href="../Styles/stylesheet.css" rel="stylesheet" type="text/css"/>
  <link href="../Styles/page_styles.css" rel="stylesheet" type="text/css"/>
 
<style type="text/css">
  h2.sgc-1 {text-align: center;}
  h3.sgc-2 {text-align: center;}
  body.sgc-3 {word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;}
</style>
</head>

Can I put the code in the style section in just one place in the epub document or does it have to be in each html file.?

theducks 01-28-2014 04:21 PM

Quote:

Originally Posted by SeaCanary (Post 2750164)
I built an epub file that has many html files in it. Every html file has the following code.
Code:

<head>
  <title>Only Remembered</title>
  <link href="../Styles/stylesheet.css" rel="stylesheet" type="text/css"/>
  <link href="../Styles/page_styles.css" rel="stylesheet" type="text/css"/>
 
<style type="text/css">
  h2.sgc-1 {text-align: center;}
  h3.sgc-2 {text-align: center;}
  body.sgc-3 {word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;}
</style>
</head>

Can I put the code in the style section in just one place in the epub document or does it have to be in each html file.?

Put it where it belongs: The stylesheet, then link the stylesheet to all the needed files.

Note: SGC Page styling as you show is NOT transferable between pages.

SGS# are assigned in the order used ON THAT FILE
so on one page SGC-1 might be used by:
h3.SGC-1 {text-align:center; font-style: italic; }
and another page
h2.SGC-1 {text-align:center; font-weight: bold; }


Create your own style selectors and replace the each class="with newname"

SeaCanary 01-28-2014 04:44 PM

Quote:

Note: SGC Page styling as you show is NOT transferable between pages.
So what you're saying is I have done it correctly?

I have two css files in the epub file with the rest of my formatting.
  1. page_styles.css
    Code:

    @page {
        margin-bottom: 5pt;
        margin-top: 5pt
        }

  2. stylesheet.css
    Code:

    .calibre {
        display: block;
        font-size: 1em;
        margin-bottom: 0;
        margin-left: 5pt;
        margin-right: 5pt;
        margin-top: 0;
        padding-left: 0;
        padding-right: 0
        }
    .versebody {
        display: block;
        margin-bottom: 0em;
        margin-left: 1em;
        text-indent:-1em;
        margin-right: 0;
        margin-top: 0em
        }
    ...


theducks 01-28-2014 05:04 PM

As long as they are linked to the pages:
In the file browser: Select all the files that make up the main body (content, usually not the boilerplate files:titlepage,coverpage)
rightclick: Link stylesheet: tick BOTH CSS you list as any existing usage not ticked will be deleted.

There is no need of the infile CSS if you cover those cases in the main CSS

h2, h3 {text-align: center; }
centers all H2 and H3.. Anyplace in the book

SeaCanary 01-28-2014 09:33 PM

Thank you.


All times are GMT -4. The time now is 10:13 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.