![]() |
#1 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 527
Karma: 1048576
Join Date: May 2009
Device: bebook; prs-950; nook simple touch; HTC Jetstream tablet
|
help with css tags
Often when dealing with a complexly formatted book, it's necessary to have many related tags in my css. For example, I might have
For line centering and spacing: .centernormal, .centerbld, .centernospc, .centerspcbase, .centerspctop, .centerbig, .centersml For paragraph indenting: .noindent, .noindentnospc, .noindentspctop, etc .indent5, .indent10, .indent15, .indent20 (where the amount is in %), etc. Sometimes I find that all of the 'center' or indent tags don't work. Perhaps of the 7 centers, only 5 will actually work when checked with Adobe DE. Sometimes the problem is solved by relocating one or more tags to different locations within the css, but this sometimes doesn't work and I find it necessary to delete tags thus making the formatting more difficult. I've assumed it has to do with a parent/child problem, but I don't really know nor do I know how to correct the problems. Can anyone help me with this? |
![]() |
![]() |
![]() |
#2 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,680
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
The tags work or don't work based on the code for the CSS tags. It has nothing to do with the tag name. You'll need to check the CSS code for the tags and fix so the tag works as expected.
You'll have to post CSS/XML code or nobody will be able to help you. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 527
Karma: 1048576
Join Date: May 2009
Device: bebook; prs-950; nook simple touch; HTC Jetstream tablet
|
Thanks for the rapid reply. When I encounter the problem again, I'll include all of the css (which usually is pretty long) and point out the problems I'm having.
Last edited by bobcdy; 11-17-2011 at 10:55 PM. |
![]() |
![]() |
![]() |
#4 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Please keep in mind that it is cascading. You can add multiple styles. In that case you can make more generic classes.
Myself I have just a normal class and add if more is needed. |
![]() |
![]() |
![]() |
#5 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
|
If rearrange the order of entries in the CSS will make something work then you have a problem where the cascade rules are failing. It is likely the CSS itself is ok but the reference code is inadvertently referencing more that one CSS entry and ADE is resolving this by using the last one (or perhaps the first one). You need to look at the source file and see if the class is referencing more than on entry. It is better to be very careful with the class statements and more precise. for example h2.center is more precise than .center. Only use classes sparingly and never for the default.
Dale |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 527
Karma: 1048576
Join Date: May 2009
Device: bebook; prs-950; nook simple touch; HTC Jetstream tablet
|
Toxaris, DaleDe,
It looks like I should learn more about style sheets; I'll have to work on this because I didn't even know that an h2.center is better to use than simply .center! What I've done is to add classes until I cover all the required formatting tags - usually this works fine but occasionally I have problems as described in my first post. Thanks for the heads-up on this. |
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Well...that depends. If I have only one style h2, I will just make a class h2 which describes how my <h2> must look like. If I have multiple, I will make one generic class h2 and then see what the changes must be.
If more than one thing needs to be centered, I might make a .center class which I then can use for all my tags. Remember, <h2 class="center"> would use the generic h2 class and then apply the .center class. Since I can reuse the .center, it keeps my stylesheet small. However, when a class needs more settings that might conflict, I use more specific classes. |
![]() |
![]() |
![]() |
#8 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
|
bobcdy: It looks to me like you have multiple classes listed in a class statement such as class="indent, center, bold" Is this the case?
Dale |
![]() |
![]() |
![]() |
#9 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 527
Karma: 1048576
Join Date: May 2009
Device: bebook; prs-950; nook simple touch; HTC Jetstream tablet
|
Dale De,
No, at least I don't think so, if you mean something like: .indent, center, bold {etc} Almost all of my classes are defined with the .center rather than p.center for example. It seems like rather than defining a tag so that I'd need a div.center and a p.center, the .center is most flexible. Thus I have .centernospc {display: block; font-weight: normal; text-align: center; margin-top: 0; margin-bottom: 0; } .centerbldspc {etc} .centerspc {etc} .indentspcbase {display: block; font-weight: normal; text-align: justify; margin-left: 2em; margin-top: 0; margin-bottom: 1em;} I would then use these classes in the xhtml text as follows: <p class="centerbldspc">This is a Headline</p> Perhaps I don't really understand your question - as you probably have guessed, I'm not really much of an expert on css and html classes beyond doing what seems to work (most of the time) and using many MR epubs as examples to emulate. Last edited by bobcdy; 11-21-2011 at 11:37 AM. |
![]() |
![]() |
![]() |
#10 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,546
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Have you validated the CSS with the W3C validator? If you have an error somewhere, it might disable all CSS, or part of it. (As far as I know, epubcheck and flightcrew do not check CSS syntax.)
|
![]() |
![]() |
![]() |
#11 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 527
Karma: 1048576
Join Date: May 2009
Device: bebook; prs-950; nook simple touch; HTC Jetstream tablet
|
I've never tried to validate when I have the problems; once I correct or work around them, then I do the validation. One reason not to do the validation is that my problems arise when there still requires much work to finish the epub, and I suspect I'd have so many errors that validation might not disclose where the css problem resides. I will try validation when I next have a problem.
Also, Dale De asked if I had muliples: did I have more than one .indent class in the css? Occasionally I upon checking the css because of various problems, I've found a duplicate. Elimination of the duplicate doesn't usually solve all my difficulties as outlined in my first post. Perhaps, however, if I have a .centernospc and a .centerspc, the CSS gets confused by the two occurrences of "center"? Last edited by bobcdy; 11-20-2011 at 01:45 PM. |
![]() |
![]() |
![]() |
#12 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,546
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Only if the reader is tremendously buggy. To a computer "centerspc" and "centernospc" are as different as "oranges" and "P12Bong32UK". It's the human involved (i.e. you) who might confuse the two.
|
![]() |
![]() |
![]() |
#13 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
|
Quote:
class="indent20 indent30" or something similar. The CSS should not get confused about near multiples that are not the same however it might if they are exactly the same. Another way you could get multiples is a <p class="indent20> and a <span class="indent30"> with exactly the same scope. Dale Last edited by DaleDe; 11-20-2011 at 03:49 PM. |
|
![]() |
![]() |
![]() |
#14 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 527
Karma: 1048576
Join Date: May 2009
Device: bebook; prs-950; nook simple touch; HTC Jetstream tablet
|
Dale,
I would never have a class="indent20 indent30", but I don't understand why a <p class="indent20"> and a <span class="indent30"> might cause problems. I'd think that an indent20 and indent30 should be different under all circumstances. Anyway, what I plan to do next is to fully organize my css; I've been sort of adding a tag anywhere in the css but will create sections devoted to various types of tags, such as centering, indenting, tables, styles, etc. and keep all appropriate tags within the proper sections of the css. Perhaps many of my problems result from lack of proper organization within the css, at least it will quickly show if I have duplicate tags. I appreciate greatly all the suggestions! I'll keep them in mind for all future epubs. If with extra care and organization, I still have a problem, I'll post the problem css. Last edited by bobcdy; 11-21-2011 at 12:03 AM. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Amazon Tags - Popular tags vs Unique tags. | chrisanthropic | Writers' Corner | 6 | 09-19-2011 11:18 PM |
css pseudo elements and adjacent combinators in extra css? | ldolse | Calibre | 2 | 12-21-2010 05:09 PM |
FBReader (Pocketbook) und CSS Tags | beluavracus | PocketBook | 5 | 10-14-2010 08:39 AM |
css override code for <h2> and <h1> tags | Amalthia | Calibre | 2 | 03-29-2009 06:51 PM |
Supported HTML/CSS tags and properties | Jellby | Bookeen | 9 | 05-04-2008 04:55 PM |