By default twine renders all the content of a passage directly over the main background.
However, what i want and have seen in a number of the twine/sugarcube games is a dynamic ‘gameplay area’. Basically another window over the background that is a separate entity from the background where the content of the passages is displayed. It’s generally dynamic and adjusts the area size to fit the amount of text or images in a given passage accordingly and can even have it’s own styling changed on the fly.
I gather this would probably be done with CSS in the stylesheet but i’m currently lost for how to go about it or to even start learning about how to go about it.
Hopefully this is clear enough, but i’m still very much learning all of this. Advisement would be appreciated!
While others have mentioned the StoryInterface passage, which essentially allows you to replace the whole SugarCube UI with your own, all it sounds like you are asking about is how to visually separate the passage from the background of the window, i.e. to put a box around it, like this:
You can obviously get a lot more fancy, adding background images and the like, but in essence this is all you need to separate out the passage from the background.
if you want that styling to differ based on passage tags, or indeed for specific passages you can add more rules, e.g.
/* Target a passage based on tags */
.passage[data-tags~="forest"] {
background: green;
}
/* Target a passage based on name */
#passage-name-as-an-id {
background: red;
}