Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 01-20-2014, 06:26 PM   #1
joshua.kendrick
Medieval Obsession
joshua.kendrick began at the beginning.
 
joshua.kendrick's Avatar
 
Posts: 4
Karma: 10
Join Date: Jan 2014
Device: Nook
Help with CSS

I am currenty trying to figure out how to have multiple text sizes for my epub. I am writing it in Sigil, and it has been an awesome tool, but when I load my CSS page, and then load my epub to my reader, it only shows a single text size and won't let me adjust it. I'm sure I'm doing something wrong. I want to be able to make my text size larger or smaller when I need to without having to continually change the coding. Any help would be great.
joshua.kendrick is offline   Reply With Quote
Old 01-20-2014, 06:57 PM   #2
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,358
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by joshua.kendrick View Post
I want to be able to make my text size larger or smaller when I need to without having to continually change the coding. Any help would be great.
Don't specify any hard-coded font-sizes in your CSS or html. Use relative units (em or %) if you need some text bigger or smaller than the regular body text.

Code:
p {
  text-indent: 1.2em;
  margin: 0;
}

p.bigger-text {
  text-indent: 1.2em;
  font-size: 1.125em;
  margin: 0;
}

p.smaller-text {
  text-indent: 1.2em;
  font-size: 0.85em;
  margin: 0;
}

Last edited by DiapDealer; 01-20-2014 at 07:02 PM.
DiapDealer is online now   Reply With Quote
Advert
Old 01-20-2014, 08:36 PM   #3
joshua.kendrick
Medieval Obsession
joshua.kendrick began at the beginning.
 
joshua.kendrick's Avatar
 
Posts: 4
Karma: 10
Join Date: Jan 2014
Device: Nook
Current CSS Coding

This is the current basic coding I am using. I think that this may be part of my issue, but I don't know.

body {
font-family: "book-antiqua";
font-size: 15px;
color: black;
background-color: white;
margin-top: 30px;
margin-bottom: 20px;
margin-left: 30px;
margin-right: 30px;
}

p {
color: black;
font-size: 15px;
font-style: normal;
font-weight: normal;
text-align: justify;
text-indent: 30px;
line-height: 22px;
}

h1 {
color: black;
font-size: 45px;
font-style: bold;
text-align: center;
line-height: 30px;
}

h2 {
color: black;
font-size: 22px;
font-style: bold;
text-align: center;
line-height: 20px;
}

h3 {
color: black;
font-size: 15px;
font-style: italic;
font-weight: normal;
text-align: justify;
line-height: 15px;
}

h4 {
color: black;
font-size: 15px;
font-style: bold;
font-weight: bold;
text-align: justify;
line-height: 1px;
}

h5 {
color: black;
font-size: 18px;
font-style: bold;
text-align: center;
line-height: 20px;
}

h6 {
color: black;
font-size: 15px;
font-style: italic;
text-align: center;
font-weight: normal;
line-height: 20px;
}

Any ideas?
joshua.kendrick is offline   Reply With Quote
Old 01-20-2014, 10:36 PM   #4
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by joshua.kendrick View Post
font-size: 15px;
That is the problem and is what DiapDealer suggested it would be.

You are using an absolute unit. This means the size will be 15 of whatever the device defines a pixel as. If you a relative unit, the device will resize according to that. I usually use "em" which is effectively the size of a character with the current font and font size. I would probably code your first three classes as:

Code:
body {
font-family: "book-antiqua";
font-size: 1em;
color: black;
background-color: white;
margin-top: 2em;
margin-bottom: 2em;
margin-left: 2em;
margin-right: 2em;
}

p {
color: black;
font-size: 1em;
font-style: normal;
font-weight: normal;
text-align: justify;
text-indent: 1.2em;
line-height: 1em;
}

h1 {
color: black;
font-size: 3em;
font-style: bold;
text-align: center;
line-height: 1em;
}
And a lot of those styles are overkill or duplicating the defaults. The way I would really code these is:

Code:
body {
margin-top: 0;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
}

p {
text-indent: 1.2em;
}

h1 {
font-size: 3em;
font-style: bold;
text-align: center;
margin-top: 1em;
margin-bottom: 2em;
}
On the Kobo devices, that would resize well. And I don't care to set the standard body font. I might set the heading font if I wanted something different and had something that fit the story.
davidfor is offline   Reply With Quote
Old 01-20-2014, 10:38 PM   #5
joshua.kendrick
Medieval Obsession
joshua.kendrick began at the beginning.
 
joshua.kendrick's Avatar
 
Posts: 4
Karma: 10
Join Date: Jan 2014
Device: Nook
So I changed all of the px to em, and bingo! I also was trying to run the whole file off a single CSS. I found it easier for me to have a seperate CSS for each section, ie, Title, Copyright, Table of Contents, so forth and so on. Seems to be working now. Thanks for the help DiapDealer and davidfor.
joshua.kendrick is offline   Reply With Quote
Advert
Old 01-21-2014, 01:03 AM   #6
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by joshua.kendrick View Post
So I changed all of the px to em, and bingo! I also was trying to run the whole file off a single CSS. I found it easier for me to have a seperate CSS for each section, ie, Title, Copyright, Table of Contents, so forth and so on. Seems to be working now. Thanks for the help DiapDealer and davidfor.
Joshua:

Really--you don't need that many stylesheets. It probably means you have a ton of duplicated and unneeded styles, which can cause issues with some readers. If you need that type of segregation, use comments in your Stylesheet to separate out the sections (we do that), for each section of the book, but having a new stylesheet for each page/piece is really overkill.

Hitch
Hitch is offline   Reply With Quote
Old 01-21-2014, 01:37 AM   #7
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
Posts: 13,306
Karma: 78876004
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
Additionally (and I'm NOT an expert at all), wouldn't one often use a class selector to override a paragraph (or other) entity, so even if you DID want different formatting on a paragraph in an Appendix as opposed to the main body you would code

Code:
p {
color: black;
font-size: 1em;
font-style: normal;
font-weight: normal;
text-align: justify;
text-indent: 1.2em;
line-height: 1em;
}
.appendix {
color: red;
}


<p>text in main body</p>
....
<p class="appendix">text in appendix</p>
PeterT is offline   Reply With Quote
Old 01-21-2014, 01:44 AM   #8
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by Hitch View Post
Joshua:

Really--you don't need that many stylesheets. It probably means you have a ton of duplicated and unneeded styles, which can cause issues with some readers. If you need that type of segregation, use comments in your Stylesheet to separate out the sections (we do that), for each section of the book, but having a new stylesheet for each page/piece is really overkill.

Hitch
Does it really make a difference whether the css is in commented blocks vs separate stylesheets? Assuming it is the same css either way. Lets say you have your special titlepage css in titlepage.css, and special story css in story.css, then link each to the appropriate page(s). It would achieve the same goal, with arguably variable efficiency in conveying the meaning of what you are trying to do.

I assume the main objective is to make sure that the same styles are not repeated on multiple stylesheets (if the different sections share identical css), nor that heaven forbid the same stylesheet is duplicated for each page.
eschwartz is offline   Reply With Quote
Old 01-21-2014, 11:47 AM   #9
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,908
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by eschwartz View Post
Does it really make a difference whether the css is in commented blocks vs separate stylesheets? Assuming it is the same css either way. Lets say you have your special titlepage css in titlepage.css, and special story css in story.css, then link each to the appropriate page(s). It would achieve the same goal, with arguably variable efficiency in conveying the meaning of what you are trying to do.

I assume the main objective is to make sure that the same styles are not repeated on multiple stylesheets (if the different sections share identical css), nor that heaven forbid the same stylesheet is duplicated for each page.
I would expect that device Memory Management would have a simpler time
not swapping multiple files on a new section file: KISS
theducks is offline   Reply With Quote
Old 01-21-2014, 01:25 PM   #10
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
What My One Twoo Wuv Ducky Said. ;-)

Hitch
Hitch is offline   Reply With Quote
Old 01-22-2014, 03:24 AM   #11
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,543
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by theducks View Post
I would expect that device Memory Management would have a simpler time
not swapping multiple files on a new section file: KISS
It wouldn't surprise me if some devices were dumb enough to read the same file again and again. In that case having separate smaller files could be more efficient
Jellby is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ADE breaks CSS --> CSS Validation: Parse Error / Value Error dasboeh ePub 4 12-10-2012 03:25 AM
Override ePub CSS with userStyle.css? barium Sony Reader Dev Corner 11 07-16-2011 03:25 PM
CSS Help Please Japes Calibre 21 06-23-2011 05:05 PM
epub CSS versus "Regular" CSS konrad ePub 4 02-18-2011 09:29 AM
css pseudo elements and adjacent combinators in extra css? ldolse Calibre 2 12-21-2010 05:09 PM


All times are GMT -4. The time now is 07:33 PM.


MobileRead.com is a privately owned, operated and funded community.