![]() |
#1 |
Medieval Obsession
![]() 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.
|
![]() |
![]() |
![]() |
#2 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,358
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
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. |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Medieval Obsession
![]() 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? |
![]() |
![]() |
![]() |
#4 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
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; } 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; } |
![]() |
![]() |
![]() |
#5 |
Medieval Obsession
![]() 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.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
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 |
|
![]() |
![]() |
![]() |
#7 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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> |
![]() |
![]() |
![]() |
#8 | |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
![]() 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. ![]() |
|
![]() |
![]() |
![]() |
#9 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
not swapping multiple files on a new section file: KISS |
|
![]() |
![]() |
![]() |
#10 |
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
![]() |
#11 | |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,543
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
|
![]() |
||||
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 |