06-11-2020, 05:23 PM | #1 |
Enthusiast
Posts: 48
Karma: 10
Join Date: Aug 2017
Device: none
|
Using HTML Entities With CSS
I want to use the html entity version of < ([ noparse ]<<[ /noparse ]) and > (>) and make anything in-between them blue. If I just did it with p or something it would be fine but that's not possible. There's also the < span > deal but I don't want to span 32k things.
Code:
<blah blah blah blah blah stuff[noparse ]>[/noparse] <blah blah blah blah blah stuff> I have no idea why it renders the entities even with the code around them. Last edited by d351r3d; 06-11-2020 at 07:03 PM. |
06-11-2020, 06:39 PM | #2 |
Grand Sorcerer
Posts: 12,167
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
Check into the [ noparse ] [ /noparse ] pair of tags in bbcode to avoid the forum handling your text.
|
Advert | |
|
06-11-2020, 07:04 PM | #3 |
Enthusiast
Posts: 48
Karma: 10
Join Date: Aug 2017
Device: none
|
|
06-11-2020, 09:51 PM | #4 |
Grand Sorcerer
Posts: 27,550
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
The noparse thing works. I use it to display entity codes all the time. Just leave the ampersand outside of the tags and the rest inside.
< < As far as making all text between the entities blue in an epub, there's no shortcut. You'll have to create 32k spans or 32k inline styles. There is no entity element that can be utilized by css. Nor any (pseudo-)selectors to specify "between elements x and y" even if there were. Last edited by DiapDealer; 06-11-2020 at 09:53 PM. |
06-12-2020, 05:13 AM | #5 | |
Enthusiast
Posts: 48
Karma: 10
Join Date: Aug 2017
Device: none
|
Quote:
< < |
|
Advert | |
|
06-12-2020, 11:35 AM | #6 |
A Hairy Wizard
Posts: 3,095
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Not sure I understand the willingness to put < around all your text but not put a span??
CSS is pretty amazing. Depending on how well your targeted reader/app supports the current standards (:first-child, :first-line, etc.), you can get some pretty fancy formatting without having to do all the spans. It would be interesting to see a sample of what you are trying to style. We might have a better solution than the < one. Cheers, |
06-12-2020, 11:37 AM | #7 |
A Hairy Wizard
Posts: 3,095
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Also, in Sigil (and I think Calibre has something similar) you can make a 'clip' to easily insert spans around your selected text.
clip: <span>\1</span> Then highlight the text and click the clip. |
06-12-2020, 11:41 AM | #8 |
Enthusiast
Posts: 48
Karma: 10
Join Date: Aug 2017
Device: none
|
The image attached is why I'm using the html entities. I'm not wrapping everything with them. <> That aren't tags bring forth errors in sigil. To make the errors go away I replaced them with the html entities
|
06-12-2020, 12:05 PM | #9 |
A Hairy Wizard
Posts: 3,095
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Try this find/replace:
Find: <(.*?)> -or- Find: <(.*?)> Replace: <span>\1</span> with this CSS: span {color:blue} |
06-12-2020, 12:09 PM | #10 | |
Enthusiast
Posts: 48
Karma: 10
Join Date: Aug 2017
Device: none
|
Quote:
Find: <(.*?)> Replace: <span><\1></span> Last edited by d351r3d; 06-12-2020 at 12:13 PM. |
|
Tags |
css, entities, epub, html |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
HTML Entities placed in ToC break Kobo Aura | trekky0623 | Calibre | 11 | 12-16-2016 04:22 PM |
More help needed. Automatic HTML entities conversion | arspr | Editor | 3 | 12-31-2013 01:45 PM |
Search & Replace issue with html entities | Aleyst | Sigil | 2 | 09-27-2011 07:49 AM |
HTML entities being changed to actual glyphs | GrannyGrump | Sigil | 4 | 09-10-2011 01:16 AM |
Why do html entities get replaced upon import? | kentmatt | Calibre | 1 | 12-08-2010 12:21 PM |