0 votes
asked 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
answered by (22.3k 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>

 

commented 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!!
commented by (60.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.

commented by (22.3k 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.

commented by (60.6k points)

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

commented 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.
Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...