0 votes
by (170 points)
Hey everyone! I asked this question before but it seems that it disappeared. Anyway, to simplify my question since the last one was pretty long, I'm running into a problem where I can't have a background color behind my text in SugarCube 2.21.0

I have a background image for the whole story but I want the text to also have a background color behind it. The "box" of color will only be the width of the text. Can't seem to get it to work cause I end up only getting borders that set of to the side.

Maybe I should have a colored box with set height and width where the whole text is in? So maybe when the player scrolls down only the text moves?

Any suggestions and advice will be my appreciated!

1 Answer

+1 vote
by (23.6k points)

If you want to only change the backgroundcolor around the text, you can do it like this:

<span style="background-color:red;">YourText</span>

 

by (170 points)
Oh my God! I just added the border radius directly to the class in the CSS file and it worked!

I'm so happy I could legit cry!

Thank you so much!!
by (68.6k points)

> Just saw that this was a problem with SugarCube 2.21.0.

No it's not.  I'm unsure what you ran into, but the example code works fine in v2.21.0.

by (23.6k points)

Just read in the documentation for 2.22.0:

"Added a parser specifically for the HTML <style> tag so that, in addition to now working as expected, it supports image passage transclusion."

and assumed this pertained to the problem at hand. Guess it must have been something else then.

by (68.6k points)

As noted right in its description, that was in reference to <style> tags, not style attributes.

by (130 points)
Would any of this work for Harlowe?

I am trying to achieve the same effect but when I insert the span code in the CSS, as above, nothing happens.
...