![]() |
#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. |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,275
Karma: 78869092
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
|
Check into the [ noparse ] [ /noparse ] pair of tags in bbcode to avoid the forum handling your text.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Enthusiast
![]() Posts: 48
Karma: 10
Join Date: Aug 2017
Device: none
|
|
![]() |
![]() |
![]() |
#4 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,341
Karma: 203719646
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. |
![]() |
![]() |
![]() |
#5 | |
Enthusiast
![]() Posts: 48
Karma: 10
Join Date: Aug 2017
Device: none
|
Quote:
< < |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,295
Karma: 20171067
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/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, |
![]() |
![]() |
![]() |
#7 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,295
Karma: 20171067
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/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. |
![]() |
![]() |
![]() |
#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
|
![]() |
![]() |
![]() |
#9 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,295
Karma: 20171067
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/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} |
![]() |
![]() |
![]() |
#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 |
|
![]() |
||||
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 |