Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Style sheet for single passage?

Kinda of new to this. Is it possible to set different stylesheets for each passage? (for example to change the background colour on each passage)

Comments

  • I don't know jack about Twine, but I assume it gives the passages an ID so you should be able to use that to style specific passages. Someone more knowledgeable would have to tell you how to find a passage's ID and such, but it should be possible in theory. My best guess is that the passage's name is probably its ID, but again that's just a guess.

    To use an ID in CSS you do it like this.

    #idname {
        background-color: #ffffff;
    }
  • It depends on which story format you are using, as they determine what base features/ functionality your story will have.

    If you are using Harlowe then the tw-passage elements generate by the javascript engine do not have IDs that you can reference, nor does it currently use the passage tags you mark passages with.

    If you are using SugarCube then you can use CSS selectors based on passage tags (preferred method) or passage IDs to selectively style individual passages or groups of passages. The following will change the text colour to green in any passage mark with a forest tag:

    body.forest .content {
    color: green;
    }
Sign In or Register to comment.