![]() |
#1 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 61
Karma: 6698
Join Date: Sep 2022
Location: South Africa
Device: kindle pw10
|
css question
Is it possible to include a text string into a css property?
For example: p.break { text-align: center; text: "this is a break"; } Then use: <p class="break"></p> Thanks |
![]() |
![]() |
![]() |
#2 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 75,769
Karma: 134321338
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
Code:
/* This is a break */ p.break { text-align: center; text-indent: 0; } |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Not Quite Dead
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 194
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
|
Yes, it is possible to use CSS to insert text into content. Use a pseudo-element.
Example: Quote:
Last edited by Brett Merkey; 04-18-2024 at 08:14 AM. |
|
![]() |
![]() |
![]() |
#4 | |
the rook, bossing Never.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,247
Karma: 89531599
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
Quote:
I've never seen it used in actual ebooks. What happens if Amazon converts the epub? What does Calibre do on conversion to LRF, PDB, mobi/KF7, azw3/kf8? Logically the css should work like a macro and the conversion have the content text where the class is invoked. But macros are one of the evil things in C and C++ with sometimes unexpected expansion. Unavoidable in Assembler. |
|
![]() |
![]() |
![]() |
#5 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,326
Karma: 58000000
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
I agree with @quoth.
Just because ![]() An e-book only uses a small subset. Even then, the 'we know better' folk that outfitted you device, chose to ignore, or took the code easy way out (User adjustable WITH Publishers settings being Algebraic) (and Posters, please verify your general comments on coding are generally Industry supported on mainstream e-readers ![]() |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
the rook, bossing Never.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,247
Karma: 89531599
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
Quote:
It works on everything. |
|
![]() |
![]() |
![]() |
#7 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 39,152
Karma: 153098470
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
I read it as the OP wanted to be able to have the text displayed at the scene break specified in the stylesheet. I've seen this done with some image based scene breaks.
|
![]() |
![]() |
![]() |
#8 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,326
Karma: 58000000
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
|
![]() |
![]() |
![]() |
#9 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 139
Karma: 1000102
Join Date: Jul 2021
Device: N/A
|
|
![]() |
![]() |
![]() |
#10 | |
the rook, bossing Never.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,247
Karma: 89531599
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
Quote:
I'd just put the actual text in the p tags, but I don't do that kind of ebook editing. |
|
![]() |
![]() |
![]() |
#11 | |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 139
Karma: 1000102
Join Date: Jul 2021
Device: N/A
|
Quote:
The restriction Theducks gave may nevertheless point to a serious problem, in case it isn't recognized by parts of the eReaders, It is still to be tested on more devices :-). BTW, this feature survives to a conversion epub -> azw3 or pdf (using calibre). |
|
![]() |
![]() |
![]() |
#12 |
Not Quite Dead
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 194
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
|
"...may be very interesting for all type of repeated features"
It certainly is. However, it is specially convenient in dealing with books that use whitespace alone for scene breaks. Whitespace is an irritating waste of space for me. The method of pseudo-elements can add a visual break without touching the HTML code or even altering the original CSS. This is easy when the whitespace is produced by adding space to any paragraph above or below where the break is wanted. Style a pseudo-element version of that paragraph and you are done. Presumably the original code will serve as a fallback if that is relevant. I've used the method only on Amazon and Samsung products for about 12 years so I do not know that range of support beyond that. Last edited by Brett Merkey; 04-18-2024 at 07:40 PM. |
![]() |
![]() |
![]() |
#13 | |
the rook, bossing Never.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,247
Karma: 89531599
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
Quote:
Also in the source wordprocessing each kind of scene break indication can have a different style. That will map 1:1 to CSS and HTML. You are right that white space scene breaks don't work as well in ebooks, especially on phone screens, where most are read. There is zero need to utilize CSS as macros to insert content. It's actually more complicated and no easier to maintain and harder to generate. It's for web page server side programming, which I've done, never for ebooks. |
|
![]() |
![]() |
![]() |
#14 | ||
the rook, bossing Never.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,247
Karma: 89531599
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
Quote:
There is no "Samsung" ebook platform. Quote:
There are many articles explaining why ebooks shouldn't slavishly copy printed books, especially novels. Replace white-space only scene breaks in the source is trivial as is reducing excessive white space that might be fine on a 9" hardback but not in an ebook. |
||
![]() |
![]() |
![]() |
#15 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 61
Karma: 6698
Join Date: Sep 2022
Location: South Africa
Device: kindle pw10
|
Thanks to all for the comments and interesting discussion. Will try the suggestions later when back from work.
Thanks again. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
A CSS question | Woodssi | Sigil | 4 | 01-18-2022 08:36 PM |
css question | ralphiedee | Sigil | 74 | 12-23-2012 06:29 AM |
CSS Question | jackibar | Sigil | 24 | 03-01-2012 09:12 AM |
CSS question | crutledge | Workshop | 17 | 12-17-2011 07:52 AM |
CSS Question | AppleTard | Calibre | 1 | 06-12-2011 12:07 AM |